Most keyboards also have function keys—keys that have names or
symbols that are not characters. Function keys are represented in
Emacs Lisp as symbols; the symbol’s name is the function key’s label,
in lower case. For example, pressing a key labeled F1 generates
an input event represented by the symbol
The event type of a function key event is the event symbol itself. See Classifying Events.
Here are a few special cases in the symbol-naming convention for function keys:
These keys correspond to common ASCII control characters that have special keys on most keyboards.
In ASCII, C-i and TAB are the same character. If the
terminal can distinguish between them, Emacs conveys the distinction to
Lisp programs by representing the former as the integer 9, and the
latter as the symbol
Most of the time, it’s not useful to distinguish the two. So normally
local-function-key-map (see Translation Keymaps) is set up
tab into 9. Thus, a key binding for character code 9
(the character C-i) also applies to
tab. Likewise for
the other symbols in this group. The function
likewise converts these events into characters.
In ASCII, BS is really C-h. But
converts into the character code 127 (DEL), not into code 8
(BS). This is what most users prefer.
Cursor arrow keys
Keypad keys (to the right of the regular keyboard).
Keypad keys with digits.
Keypad PF keys.
Keypad arrow keys. Emacs normally translates these into the
corresponding non-keypad keys
Additional keypad duplicates of keys ordinarily found elsewhere. Emacs normally translates these into the like-named non-keypad keys.
You can use the modifier keys ALT, CTRL, HYPER, META, SHIFT, and SUPER with function keys. The way to represent them is with prefixes in the symbol name:
The alt modifier.
The control modifier.
The hyper modifier.
The meta modifier.
The shift modifier.
The super modifier.
Thus, the symbol for the key F3 with META held down is
M-f3. When you use more than one prefix, we recommend you
write them in alphabetical order; but the order does not matter in
arguments to the key-binding lookup and modification functions.