Keyboard Translations
Some keyboards do not make it convenient to send all the special
characters that Emacs uses. The most common problem case is the
<DEL> character. Some keyboards provide no convenient way to type
this very important character--usually because they were designed to
expect the character C-h to be used for deletion. On these
keyboards, if you press the key normally used for deletion, Emacs handles
the C-h as a prefix character and offers you a list of help
options, which is not what you want.
You can work around this problem within Emacs by setting up keyboard
translations to turn C-h into <DEL> and <DEL> into
C-h, as follows:
;; Translate C-h to <DEL>.
(keyboard-translate ?\C-h ?\C-?)
;; Translate <DEL> to C-h.
(keyboard-translate ?\C-? ?\C-h)
Keyboard translations are not the same as key bindings in keymaps
(see Keymaps). Emacs contains numerous keymaps that apply in
different situations, but there is only one set of keyboard
translations, and it applies to every character that Emacs reads from
the terminal. Keyboard translations take place at the lowest level of
input processing; the keys that are looked up in keymaps contain the
characters that result from keyboard translation.
On a window system, the keyboard key named <DELETE> is a function
key and is distinct from the ASCII character named <DEL>.
See Named ASCII Chars. Keyboard translations affect only ASCII
character input, not function keys; thus, the above example used on a
window system does not affect the <DELETE> key. However, the
translation above isn't necessary on window systems, because Emacs can
also distinguish between the <BACKSPACE> key and C-h; and it
normally treats <BACKSPACE> as <DEL>.
For full information about how to use keyboard translations, see
Translating Input.
|