(emacs)User Input

Next: Keys Prev: Screen Up: Top

Keyboard Input

   GNU Emacs uses an extension of the ASCII character set for keyboard
input.  ASCII consists of 128 character codes.  Some of these codes are
assigned graphic symbols such as `a' and `='; the rest are control
characters, such as `Control-a' (usually written `C-a' for short).
`C-a' gets its name from the fact that you type it by holding down the
CTRL key and then pressing `a'.

   Some control characters have special names, and special keys you can
type them with: for example, RET, TAB, LFD, DEL and ESC.  The space
character is usually referred to below as SPC, even though strictly
speaking it is a graphic character whose graphic happens to be blank.

   On ASCII terminals, the shift key is meaningless with control
characters: `C-a' and `C-A' are the same character, and Emacs cannot
distinguish them.  Under X Windows, these are distinct characters, but
the standard key bindings treat them the same in all contexts.

   On ASCII terminals, there are only 32 possible control characters.
These are the control variants of letters and `@[]\^_'.  Under X
Windows, every non-control character has a control variant.  For
example, `C-+' and `C-5' are meaningful under X.

   Emacs extends the ASCII character code by adding an extra bit to each
character.  The additional bit is called Meta.  Any character can be
made Meta; examples of Meta characters include `Meta-a' (normally
written `M-a', for short), `M-A' (not the same character as `M-a', but
those two characters normally have the same meaning in Emacs), `M-RET',
and `M-C-a'.  For traditional reasons, `M-C-a' is usually called
`C-M-a'; logically speaking, the order in which the modifier keys CTRL
and META are mentioned does not matter.

   Some terminals have a META key, and allow you to type Meta
characters by holding this key down.  Thus, `Meta-a' is typed by
holding down META and pressing `a'.  The META key works much like the
SHIFT key.  Such a key is not always labeled META, however, as this
function is often a special option for a key with some other primary

   If there is no META key, you can still type Meta characters using
two-character sequences starting with ESC.  Thus, to enter `M-a', you
could type `ESC a'.  To enter `C-M-a', you would type `ESC C-a'.  ESC
is allowed on terminals with Meta keys, too, in case you have formed a
habit of using it.

   X Windows provides several other modifier keys that can be applied to
any keyboard input character.  These are called SUPER, HYPER and ALT.
With them, you can make characters that we denote with `s-', `H-' and
`A-'.  Thus, `s-H-C-x' is short for `Super-Hyper-Control-x'.  Not all X
terminals actually provide keys for these modifier flags, and the
standard key bindings of Emacs do not include such characters.  But you
can assign them meanings of your own by customizing Emacs.

   Keyboard input includes keyboard keys that are not characters at all:
for example function keys and arrow keys.  Mouse buttons are also
outside the gamut of characters.  These inputs do not have numeric
character codes.  Instead, Emacs represents them by their names
(actually, Lisp objects called "symbols").

   Input characters and non-character inputs are collectively called
"input events".

   ASCII terminals cannot really send anything to the computer except
ASCII characters.  These terminals use a sequence of characters to
represent each function key.  But that is invisible to the Emacs user,
because the keyboard input routines recognize these special sequences
and converts them to names before any other part of Emacs gets to see

automatically generated by info2www