Skip to main content

40.16 Operating on X11 Keysyms

To define system-specific X11 keysyms, set the variable system-key-alist.

variable system-key-alist

This variable’s value should be an alist with one element for each system-specific keysym. Each element has the form (code . symbol), where code is the numeric keysym code (not including the vendor-specific bit, -2**28), and symbol is the name for the function key.

For example (168 . mute-acute) defines a system-specific key (used by HP X servers) whose numeric code is -2**28 + 168.

It is not crucial to exclude from the alist the keysyms of other X servers; those do no harm, as long as they don’t conflict with the ones used by the X server actually in use.

The variable is always local to the current terminal, and cannot be buffer-local. See Multiple Terminals.

You can specify which keysyms Emacs should use for the Control, Meta, Alt, Hyper, and Super modifiers by setting these variables:

variable x-ctrl-keysym

variable x-alt-keysym

variable x-meta-keysym

variable x-hyper-keysym

variable x-super-keysym

The name of the keysym that should stand for the Control modifier (respectively, for Alt, Meta, Hyper, and Super). For example, here is how to swap the Meta and Alt modifiers within Emacs:

(setq x-alt-keysym 'meta)
(setq x-meta-keysym 'alt)