(emacs.info) Non-ASCII Rebinding
Info Catalog
(emacs.info) Named ASCII Chars
(emacs.info) Key Bindings
(emacs.info) Mouse Buttons
Non-ASCII Characters on the Keyboard
------------------------------------
If your keyboard has keys that send non-ASCII characters, such as
accented letters, rebinding these keys is a bit tricky. There are two
solutions you can use. One is to specify a keyboard coding system,
using `set-keyboard-coding-system' ( Specify Coding). Then you
can bind these keys in the usual way, but writing
(global-set-key [?CHAR] 'some-function)
and typing the key you want to bind to insert CHAR.
If you don't specify the keyboard coding system, that approach won't
work. Instead, you need to find out the actual code that the terminal
sends. The easiest way to do this in Emacs is to create an empty buffer
with `C-x b temp <RET>', make it unibyte with `M-x
toggle-enable-multibyte-characters <RET>', then type the key to insert
the character into this buffer.
Move point before the character, then type `C-b C-x ='. This
displays a message in the minibuffer, showing the character code in
three ways, octal, decimal and hexadecimal, all within a set of
parentheses. Use the second of the three numbers, the decimal one,
inside the vector to bind:
(global-set-key [DECIMAL-CODE] 'some-function)
Info Catalog
(emacs.info) Named ASCII Chars
(emacs.info) Key Bindings
(emacs.info) Mouse Buttons
automatically generated by
info2html