GNU Info

Info Node: (efaq)Swapping keys

(efaq)Swapping keys


Next: Producing C-XXX with the keyboard Prev: stty and Backspace key Up: Key bindings
Enter node , (file) or (file)node

How do I swap two keys?
=======================

   In Emacs 19, you can swap two keys (or key sequences) by using the
`keyboard-translate' function.  For example, to turn `C-h' into <DEL>
and <DEL> to `C-h', use

     (keyboard-translate ?\C-h ?\C-?)  ; translate `C-h' to DEL
     (keyboard-translate ?\C-? ?\C-h)  ; translate DEL to `C-h'.

The first key sequence of the pair after the function identifies what is
produced by the keyboard; the second, what is matched for in the
keymaps.

   Keyboard translations are not the same as key bindings in 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.

   Note: Keyboard Translations.


automatically generated by info2www version 1.2.2.9