Emacs keybinding guide

Emacs keybinding guide

Post by Jari Aalto+mail.ema » Fri, 11 Jul 2003 18:56:14



Archive-name: GNU-Emacs-FAQ/keybindings-pointer
Posting-Frequency: 2 times a month
URL: http://tiny-tools.sourceforge.net/emacs-keys.html
Maintainer: Jari Aalto <jari.aa...@poboxes.com>

Announcement: "All you wanted to know about Emacs keybindings"

    Note, [X]Emacs FAQ is available to you via keypress C-h F.

    Document discusses how do you deal with Emacs keybindings. There is
    step by step instructions how you use your X window's `xmodmap' program
    to start using emacs better in X.

    Document also explains how to set up special xterm for telnet
    connections -- running remote emacs with transparent keybinding.
    Finally includes many ready examples and questions and answers compiled
    from usenet emacs newsgroups.

An exerpt from the document

    2.1 Foreword to different emacs platforms

        The old Emacs C-A-S-H-M modifiers map to new syntax like this:

            old Emacs       Emacs 19.30+ and XEmacs19.14+
            [C-tab]         [(control tab)]
            [A-1]           [(alt ?1)]
            [S-up]          [(shift up)]
            [H-prior]       [(hyper prior)]   ;; in HP prior = PgUp
            [M-f1]          [(meta f1)]

        The [()] syntax works fine between the Emacs and XEmacs, but
        there are problems with themouse symbol names, which are
        different:

            [(control shift mouse-1)]         ;; Emacs name:  mouse-1
            [(control shift button1up)]       ;; XEmacs name: button1up

    2.2 Emacs versions and keybinding syntax compatibility table:

            m-1     : recognizes Emacs  styled mouse binding, `mouse-1'
            b1      : recognizes XEmacs styled mouse binding, `button1'
            r-k-m   : read-kbd-macro
            _yes    : works 95%, but there are known bugs.

            ------------------------------------------------------
            style:              []    [()]  m-1   b1    r-k-m  kbd
            ------------------------------------------------------
            Emacs   19.28-30    yes   no    yes   no    no     no
            Emacs   19.31-33    yes   yes   yes   no    bugs   no
            Emacs   19.34       yes   yes   yes   no    _yes   no
            Emacs   20.1-4      yes   yes   yes   no    yes    yes
            Emacs   21.1        yes   yes   yes   no    yes    yes
            ------------------------------------------------------
            XEmacs  19.13-14    no    yes   no    yes   no     no
            XEmacs  19.15-16    no    yes   _yes  yes   yes    no
            XEmacs  20.2-5      no    yes   yes   yes   yes    yes
            ------------------------------------------------------

        [SL Baur <st...@xemacs.org>] There is no XEmacs 20.1. There are two
        flavors of XEmacs 20.0 floating around. They are not compatible.
        One is more like XEmacs 19.14 (the one on the Sun CD), the other
        (the 'net released one) is more like XEmacs 19.15/16. Note that the
        form `[C-A-S-H-M]' will never be supported by XEmacs.

Table of contents

        1.0 Document id
            1.1 Description
            1.2 Required pre-knowledge
            1.3 Related lisp packages
            1.4 Credits

        2.0 Quick reference -- finding the key syntax
            2.1 Foreword to different emacs platforms
            2.2 Emacs versions and keybinding syntax compatibility table:
            2.3 Ethics -- what is the correct way?
            2.4 The M-x view-lossage command helps you
            2.5 Using read-kbd-macro
            2.6 Very easy way: just go and use M-x global-set-key
            2.7 Using key-description by Kevin Rodgers

        3.0 How do I give argument to command when I bind it to key?
            3.1 Printing a string by pressing a key
            3.2 Running macro by pressing a key
            3.3 Running existing user functions
            3.4 Running your own lisp function
            3.5 Runnning function by mouse click
            3.6 Calling function with different default argument
            3.7 Using complex lambda function in keybinding

        4.0 About keymaps
            4.1 Before defining the key, you should know about keymaps
            4.2 Default emacs keymaps and packages' keymaps
            4.3 Prefix keymaps in new emacs versions.
            4.4 Prefix keymaps in old emacs versions.
            4.5 Function-key-map -- where do I need it?
            4.6 How to generate C-A-S-H-M modifiers from keyboard keys
            4.7 Local-set-key and global-set-key note

        5.0 Ascii and non-ascii keys
            5.1 Emacs info, Character Type
            5.2 General description
            5.3 Emacs info, Named ascii characters
            5.4 Case study: Why can't I assign key <ESC C-'> ?
            5.5 Case study: How to bind a function to Ctrl-?
            5.6 Portable keybindings -- command 'emacs -nw' is your friend

        6.0 Emacs backspace binding problem
            6.1 Related packages
            6.2 Foreword -- background
            6.3 Windowed Emacs mapping
            6.4 Non-windowed Emacs mapping
            6.5 Mapping backspace with 'delete' symbol

        7.0 Some article snippets, Q/A
            7.1 I can't use C-s and C-q in emacs due to control flow.
            7.2 Disable C-s/C-q for flow control?
            7.3 Defining keys to isearch map?
            7.4 I'm in emacs that doesn't recognize my function keys?
            7.5 I don't seem to see the Control-Space sequence
            7.6 To get Xterm work with mouse
            7.7 Does these vector, notations work only under X ?
            7.8 I have troubles running 'screen' (SUN-OS virtual term) and emacs
            7.9 Modifying keyboard keys in X
            7.10 Win95: swapping ctrl-caps keys ?
            7.11 Swap the control and cap keys on Sun sparc 20 machine?
            7.12 Xterm -- AIX: Meta key missing in emacs -nw
            7.13 HP: meta key missing on 715 and 712?
            7.14 HP: there's no Meta key?
            7.15 HP: Jari's xmodmap settings in PC XCeed
            7.16 Could anyone tell me how I could change the meta-key ?
            7.17 How can I set Meta key to Alt?
            7.18 How can I make the alt key work as the meta key?
            7.19 On X window C-SPC says Args out of range #^[nil nil nil
            7.20 Carpal tunnel syndrome: Any way to reduce left wrist pain?
            7.21 Telnet connection -- backspace ?
            7.22 Latin Charset handling ?
            7.23 Linux: I can't rebind C-up in terminal window?
            7.24 Linux: cursor keys problem

        8.0 Xmodmap introduction -- Changing your X environment
            8.1 How X keybindings work
            8.2 Xmodmap and keysyms -- as explained in the 'xkeycaps'
            8.3 Example -- xmodmap for select and kp-f1
            8.4 Example -- sun keyboard xmodamp
            8.5 Example -- remap the control key

        9.0 Code
            9.1 Perl code to remap Meta-Modeswitch

        10.0 CASE STUDY -- Connection to remote emacs through Xterm
            10.1 Foreword
            10.2 The connection does not know my keyboard
            10.3 How do I know what a key produces (ascii sequences?)
            10.4 Short xmodmap(1) glimpse
            10.5 Xev -- Spot your X-events(keys) easily
            10.6 Xterm's -xrm switch for key settings, where are the key names?
            10.7 Custom xterm -- making xterm to translate character for connection
            10.8 Remote emacs setup
            10.9 Testing the special Xterm and remote emacs co-operation
            10.10 Complete, live, setup -- Modify to personal needs