A Curious Look at GNU Emacs's 1000+ Default Keybinding

, , …,

In Emacs, there's a command describe-bindingsF1 b】. By default, there are a total of 1353 bindings. In this page, let's look at what they are. (you can get the list by calling describe-bindings in emacs, or see this file: gnu_emacs_keybinding.txt.)

Help, F1, 【C-h】

There are 48 keys with <help> notation. (gnu_emacs_keybinding_help.txt) Example:

<help>       help-command
<help> C-a   about-emacs
<help> C-c   describe-copying
<help> C-d   view-emacs-debugging
<help> C-e   view-external-packages
<help> C-f   view-emacs-FAQ
<help> i     info
<help> k     describe-key
<help> l     view-lossage
<help> m     describe-mode
Symbolics's Lisp Machine keyboard PN 365407 Rev C. (Photo by Joey Devilla. Used with permission.) 〔☛ Space-cadet Keyboard and Lisp Machine Keyboards

The Help is a key on lisp keyboard, but also on many other keyboards, including NeXT Machine, Sun Microsystem's Keyboard, and older Apple keyboard. See: Source www.pfu.fujitsu.com.

Then there are 48 keys with <f1> notation. (gnu_emacs_keybinding_f1.txt) Example:

<f1>       help-command
<f1> C-a   about-emacs
<f1> C-c   describe-copying
<f1> C-d   view-emacs-debugging
<f1> C-e   view-external-packages
<f1> C-f   view-emacs-FAQ
<f1> i     info
<f1> k     describe-key
<f1> l     view-lossage
<f1> m     describe-mode

There are also 48 keys with C-h notation. (gnu_emacs_keybinding_C-h.txt)

C-h       help-command
C-h C-a   about-emacs
C-h C-c   describe-copying
C-h C-d   view-emacs-debugging
C-h C-e   view-external-packages
C-h C-f   view-emacs-FAQ
C-h i     info
C-h k     describe-key
C-h l     view-lossage
C-h m     describe-mode

All these are equivalent maps. (That is: F1 = Help = 【Ctrl+h】) It's interesting to note that these do not seem to be key translations. Instead, each binding is defined explicitly in each set.

【C-x 8】 for Special Symbol Input

There are 138 bindings for C-x 8. (gnu_emacs_keybinding_C-x_8.txt) Sample:

C-x 8 <   «
C-x 8 =   ¯
C-x 8 >   »
C-x 8 ?   ¿
C-x 8 C   ©
C-x 8 L   £
C-x 8 P   ¶
C-x 8 R   ®
C-x 8 S   §
C-x 8 Y   ¥
C-x 8 ^   Prefix Command

These are for inputting special symbols, ⁖ ¿ ¡ ¢ £ ¥ ¤ § ¶ ® © ª «» × ÷ ¬ ° ± µ ÀÁÂÃÄÅÆ Ç ÈÉÊË ÌÍÎÏ ÐÑ ÒÓÔÕÖ ØÙÚÛÜÝÞß àáâãäåæç èéêë ìíîï ðñòóôõö øùúûüýþÿ. 〔☛ Emacs & Unicode Tips

【C-x】 Prefix

There are 204 with the C-x notation. (gnu_emacs_keybinding_C-x.txt) Example:

C-x C-@   pop-global-mark
C-x C-b   list-buffers
C-x C-c   save-buffers-kill-terminal
C-x C-d   list-directory
C-x C-e   eval-last-sexp
C-x C-f   find-file
C-x TAB   indent-rigidly
C-x $   set-selective-display
C-x '   expand-abbrev
C-x (   kmacro-start-macro
C-x )   kmacro-end-macro
C-x *   calc-dispatch
C-x +   balance-windows
C-x -   shrink-window-if-larger-than-buffer
C-x .   set-fill-prefix
C-x 0   delete-window
C-x 1   delete-other-windows
C-x 2   split-window-vertically
C-x a   Prefix Command
C-x b   switch-to-buffer
C-x d   dired
C-x e   kmacro-end-and-call-macro
C-x f   set-fill-column
C-x h   mark-whole-buffer
C-x <C-left>  previous-buffer
C-x <C-right> next-buffer
C-x <left>    previous-buffer
C-x <right>   next-buffer
C-x C-k C-a   kmacro-add-counter
C-x C-k C-c   kmacro-set-counter
C-x C-k C-d   kmacro-delete-ring-head
C-x C-k C-e   kmacro-edit-macro-repeat
C-x C-k C-f   kmacro-set-format

The 【Ctrl+x …】 is a generic prefix for frequently used commands that are useful globally. This one is most familiar to emacs users. Note: another combo familiar to most emacs users is 【Ctrl+c …】. It is for mode-specific commands, not shown on this page because you need to be in a specific major mode.

“view-mode” Minor Mode Keys

There are 38 keys for view-mode. (gnu_emacs_keybinding_view-mode.txt) They are almost all single symbol keys. Example:

0 .. 9   digit-argument
<     beginning-of-buffer
=     what-line
>     end-of-buffer
?     describe-mode
@     View-back-to-mark
C     View-kill-and-leave
E     View-exit-and-edit
F     View-revert-buffer-scroll-page-forward
H     describe-mode
Q     View-quit-all

Ctrl+Meta Bindings (C-M)

Symbolics's Lisp Machine keyboard PN 365407 Rev C. (Photo by Joey Devilla. Used with permission.) 〔☛ Space-cadet Keyboard and Lisp Machine Keyboards

There are 36 bindings with notation C-M-. (gnu_emacs_keybinding_C-M-.txt) Example:

<C-M-down>   down-list
<C-M-end>    end-of-defun
<C-M-home>   beginning-of-defun
<C-M-left>   backward-sexp
<C-M-right>  forward-sexp
<C-M-up>     backward-up-list
C-M-@     mark-sexp
C-M-a     beginning-of-defun
C-M-b     backward-sexp
C-M-c     exit-recursive-edit
C-M-d     down-list
C-M-j     indent-new-comment-line
C-M-k     kill-sexp

These are designed to navigate/edit lisp code. 〔☛ How to Edit Lisp Code with Emacs

Note the M- is the syntax for Meta key. It is a key on Lisp keyboards. Today, by default, the Alt key on PC keyboards is interpreted as Meta.

Ctrl, Meta, Esc keys

Some of the Ctrl definitions is Ctrl with mouse button.

Alt Key

There are 137 bindings starting with the notation A-. (gnu_emacs_keybinding_A-.txt) Here's a sample:

A-<             «
A-=             ¯
A->             »
A-?             ¿
A-C             ©
A-L             £
A-P             ¶
A-R             ®
A-S             §
A-Y             ¥
A-^		Prefix Command

These are keybindings for the Alt key. This keybinding set is identical to 【Ctrl+x 8】 (gnu_emacs_keybinding_C-x_8.txt), except there's no 【Alt Enter ↵】 corresponding to 【Ctrl+x 8 Enter ↵】 (which is bind to “ucs-insert”, which starts the Unicode char insection mode.).

Note that emacs interpret Alt as Meta by default, so these A- bindings have no effect. However, you can still type Alt by 【Ctrl+x @ a】. ((info "(emacs) Modifier Keys")) Or, on Windows, set (setq w32-alt-is-meta nil). ((info "(emacs) Windows Keyboard"))

Some notes about Alt key and inputting special symbols:

sun keyboard ret
The ◆ Meta, ⎄ Compose, AltGr keys, on Sun Microsystem's Type 6 Keyboard

Dead Keys

There are 226 bindings with the notation of dead- in it. (gnu_emacs_keybinding_dead.txt) Example:

<S-dead-acute>        Prefix Command
<dead-acute>          Prefix Command
<S-dead-tilde>        A Ã
<S-dead-asciitilde>   A Ã
<dead-tilde>          A Ã
<S-dead-grave>        A À
<dead-grave>          A À
<S-dead-circumflex>   1 ¹
<S-dead-circum>       1 ¹
<S-dead-asciicircum>  1 ¹
<dead-circumflex>     1 ¹
<dead-circum>         1 ¹
<dead-asciicircum>    1 ¹
<S-dead-acute>        A Á
<dead-acute>          A Á
<S-dead-diaeresis>    A Ä
<dead-diaeresis>      A Ä

These are binding for Dead key for entering chars with Diacritic marks. A dead key is a modifier key similar in concept to Alt Graph key, except that it doesn't produce a char until another key is pressed. Dead key are used to enter chars such as: à è ì ò ù á é í ó ú â ê î ô û ä ë ï ö ü.

Microsoft 4000 keyboard French dead key
Microsoft Natural Ergonomic Keyboard 4000, with French layout. The ^ and ¨ (to the right of P) are dead keys. (Full keyboard 1280×749) (photo by Alexander Sidorov.)
France kbd
French layout. File:KB France.svg

Many European language layout have dead keys. See: International Keyboard Layouts.

On the Mac, 【⌥ Opt+e】 is a dead key. It adds the acute mark to any letter typed after.

Here's example of letters with diacritic and their names.

Note that the S- is the notation for the ⇧ Shift key. So, <S-dead-tilde> A would be 【⇧ Shift+dead ~+A】.

(Thanks to Frédéric Perrin, Jason Rummey, Nei, for help. Thanks to Devon Sean McCullough on explaining space cadet keyboard Alt Mode key.)

(For some notes about accent marks, see: Diacritics: Trema, Umlaut, Macron, Circumflex, and All That.)

Mute Keys

There's also 70 keys with the notation of mute-, similar to the “dead” above. (gnu_emacs_keybinding_mute.txt) Not sure what they are.

Number Pad Keys

There are 56 bindings for the keys on the numberic keypad. They have notation kp-. (gnu_emacs_keybinding_kp-.txt) Example:

<C-S-kp-1>  <C-S-end>
<C-S-kp-2>  <C-S-down>
<C-S-kp-3>  <C-S-next>
<M-kp-next> <M-next>
<S-kp-down> <S-down>
<S-kp-end>  <S-end>
<S-kp-home> <S-home>
<S-kp-left> <S-left>
<S-kp-next> <S-next>
<kp-0>    0
<kp-1>    1
<kp-2>    2
<kp-add>      +
<kp-decimal>  .
<kp-delete>   C-d
<kp-divide>   /
<kp-down>     <down>
<kp-end>      <end>

All these are key translations. They do not do anything special. For example, keypad 0 is the same as the 0 key on the main typing area. So, the code <kp-0> translates to 0. When Num Lock is off, the 4 key on numpad is the key. So, the code <S-kp-left> (which means holding down ⇧ Shift then pressing the on the numpad) simply translates to <S-left>.

Function keys, Home/End, Page Up/Down, Tab, … Keys

Here's some special keys, such as {F1, ↖ Home, ↘ End, Tab ↹, Enter ↵, ❖ Win, ▤ Menu, ⇞ Page △, ⇟ Page ▽, …}. (gnu_emacs_keybinding_function_keys.txt) Example:

<escape>	ESC

TAB		forward-button
<backtab>	backward-button
<backspace>	DEL
<return>	RET
<tab>		TAB

<home>		move-beginning-of-line
<end>		move-end-of-line
<insert>	overwrite-mode
<delete>	C-d

<prior>		scroll-down
<next>		scroll-up

<lwindow>	ignore
<rwindow>	ignore
<menu>		execute-extended-command

<right>		forward-char
<left>		backward-char
<up>		previous-line
<down>		next-line

<f3>		kmacro-start-macro-or-insert-counter
<f4>		kmacro-end-or-call-macro
<f10>		menu-bar-open
<f16>		clipboard-kill-ring-save
<f18>		clipboard-yank
<f20>		clipboard-kill-region

Note: Syntax such as {RET, TAB, DEL, ESC, …}, are actual ASCII characters. While {<return>, <tab>, <delete>, <escape>, …} are special keys.

Note the {<F16>, <F18>, <F20>}. Some keyboards have function keys up to 24 of them.

Mouse and Others

Here's the rest of the keys: gnu_emacs_keybinding_rest.txt.


<mouse-1>       mouse-set-point
<mouse-2>       help-follow-mouse
<mouse-3>       mouse-save-then-kill
<wheel-down>                    mwheel-scroll
<wheel-up>      mwheel-scroll
<mouse-movement>                ignore
<S-down-mouse-1>                mouse-appearance-menu
<S-mouse-3>     kmacro-end-call-mouse
<S-wheel-down>  mwheel-scroll
<S-wheel-up>    mwheel-scroll
<double-mouse-1>                mouse-set-point
<triple-mouse-1>                mouse-set-point
<down-mouse-1>  mouse-drag-region
<drag-mouse-1>  mouse-set-region
<drag-n-drop>   w32-drag-n-drop

Copy, Cut, Paste, …, Keys

<again>         repeat-complex-command
<redo>          repeat-complex-command
<undo>          undo
<copy>          clipboard-kill-ring-save
<cut>           clipboard-kill-region
<paste>         clipboard-yank
<execute>       execute-extended-command
<open>          find-file
<find>          search-forward

<begin>         beginning-of-buffer
<compose-last-chars>            compose-last-chars
<language-change>               ignore

<backtab>       backward-button
<S-insertchar>  yank
<delete-frame>  handle-delete-frame
<deletechar>    delete-char
<deleteline>    kill-line

Some of these keys can be seen on Sun Microsystem's keyboard. (alas, Sun just died a year ago.)

Sun Microsystem's Keyboard
The special function keys for Copy, Paste, etc. Note that most of these keys have standard scancode in USB protocol. Some PC keyboards also have dedicated {Copy, Cut, Paste} keys in the 1990s, but it fell out of fashion. More photos: Sun Microsystem's Type 6 Keyboard.


<header-line>   Prefix Command
<iconify-frame>                 ignore-event
<insertchar>    overwrite-mode
<insertline>    open-line
<left-fringe>   Prefix Command
<make-frame-visible>            ignore-event
<mode-line>     Prefix Command
<right-fringe>  Prefix Command
<select-window>                 handle-select-window
<switch-frame>                  handle-switch-frame
<vertical-line>                 Prefix Command
<vertical-scroll-bar>           Prefix Command

<vertical-line> <down-mouse-1>  mouse-drag-vertical-line
<vertical-line> <mouse-1>       mouse-select-window

<vertical-scroll-bar> <mouse-1>

<header-line> <down-mouse-1>    mouse-drag-header-line
<header-line> <mouse-1>         mouse-select-window

<mode-line> <down-mouse-1>      mouse-drag-mode-line
<mode-line> <drag-mouse-1>      mouse-select-window
<mode-line> <mouse-1>           mouse-select-window
<mode-line> <mouse-2>           mouse-delete-other-windows
<mode-line> <mouse-3>           mouse-delete-window

These may not be actual keys. When emacs define actions for mouse or menu, it defines a pseudo-key with keyboard syntax. So <mode-line> <mouse-1> means clicking on the mode line. <vertical-scroll-bar> <mouse-1> means clicking on the scroll bar.

No Super & Hyper?

Curiously, there's no definition for ❖ Super s- and Hyper H- keys. These are the other prominent keys on lisp keyboard other than Meta M-. 〔☛ Emacs: How to define Super & Hyper Keys

blog comments powered by Disqus