(emacs)Keys


Next: Commands Prev: User Input Up: Top

Keys
====

   A "key sequence" ("key", for short) is a sequence of input events
that combine as part of the invocation of a single command.  Recall
that input events include both keyboard characters and non-character
inputs (function keys, arrow keys, mouse buttons, and so forth).

   If the sequence is enough to invoke a command, it is a "complete
key".  If it isn't long enough to be complete, we call it a "prefix
key".  Examples of complete keys include `C-a', `X', RET, NEXT (a
function key), DOWN (an arrow key), `C-x C-f' and `C-x 4 C-f'.

   Most single characters constitute complete keys in the standard Emacs
command bindings.  A few of them are prefix keys.  A prefix key can be
followed by additional input characters (or other events) to make a
longer key, which may itself be complete or a prefix.

   For example, `C-x' is a prefix key, so `C-x' and the next input
character combine to make a two-character key sequence.  Most of these
key sequences are complete keys, including `C-x C-f' and `C-x b'.  A
few, such as `C-x 4' and `C-x r', are themselves prefix keys that lead
to three-character key sequences.  There's no limit to the length of a
key sequence, but any key sequence longer than one character must be
reached through a chain of prefix keys.

   By contrast, the two-character sequence `C-f C-k' is not a key,
because the `C-f' is a complete key in itself.  It's impossible to give
`C-f C-k' an independent meaning as a command.  `C-f C-k' is two key
sequences, not one.

   All told, the prefix keys in Emacs are `C-c', `C-x', `C-h', `C-x
C-a', `C-x n', `C-x r', `C-x v', `C-x 4', `C-x 5', and ESC.  But this
is not cast in concrete; it is just a matter of Emacs's standard key
bindings.  In customizing Emacs, you could make new prefix keys, or
eliminate these.  Note: Key Bindings.

   Whether a sequence is a key can be changed by customization.  For
example, if you redefine `C-f' as a prefix, `C-f C-k' automatically
becomes a key (complete, unless you define it too as a prefix).
Conversely, if you remove the prefix definition of `C-x 4', then `C-x 4
f' (or `C-x 4 ANYTHING') is no longer a key.

   Typing the help character (`C-h') after a prefix character usually
displays a list of the commands starting with that prefix.  There are a
few prefix characters for which this doesn't work--for historical
reasons, they have other meanings for `C-h' which are not easy to
change.


automatically generated by info2www