Emacs Keys: Syntax

By Xah Lee. Date: . Last updated: .

Find Key Syntax

Alt+x describe-key
prompt user to type a key sequence, and display the key syntax and command bound to it, if any.

key sequence can be a single key, or any sequence with modifier keys.

For example, suppose you want to know the syntax for the key press of Ctrl+Alt+t.

  1. Alt+x describe-key
  2. press Ctrl+Alt+t, emacs prints “C-M-t runs the command transpose-sexps”. That means, "C-M-t" is the key syntax.

(Note: emacs has a lot syntax variations for a given key combination, but the one printed by describe-key is guaranteed to work.)

once you know the key syntax, you can bind the key by:

Key Syntax Examples

One Modifier

Function keys

Numberpad Keys

Arrow and Home End Cluster Keys

Enter, Return, Space, Backspace Keys

Function Keys (ELISP Manual)

1 Modifier + Special Key

2 Modifier Keys

2 modifier keys pressed simultaneously, plus a letter key:

Example of 2 modifier keys with a digit key:

3 Modifier Keys

3 modifier keys pressed simultaneously:

No Modifiers

A shortcut can be created without any modifier keys.

Menu Key

Super and Hyper Keys

Key Sequence

Emacs, Change Keys