The Modernization of Emacs: keyboard shortcuts pain
xah at xahlee.org
Sun Aug 5 03:27:24 CEST 2007
The following article a extended version of previous post.
A HTML version can be found at
WHY EMACS'S KEYBOARD SHORTCUTS ARE PAINFUL
Xah Lee, 2007-07
A important aspect in designing a keyboard shortcut set, for a
application that has intensive, repetitive, prolonged human-machine
interaction (such as coding and text editing), is to consider
ergonomic principles. Specifically: allocate keyboard shortcuts for
the most frequently used commands, and, the top most frequently used
commands should have most easily-pressed keystrokes. For example, they
should be on the home row.
This article shows why Emacs's keyboard shortcut set are the most
THE SWAPPING OF CONTROL AND META MODIFIERS
Emacs's keyboard shortcuts is very inefficient. The primary cause is
because, emacs's keyboard shortcuts are designed with a keyboard that
practically has the Ctrl and Alt key positions swapped.
Space Cadet keyboard
above: The Space-cadet keyboard (Source↗, 2007-07) .
The common keyboard used around emacs era in the 1980s are those
keyboards from Lisp Machines↗. (see Space-cadet keyboard↗) The
keyboard on lisp machines have the Control key right besides the space
bar (similar to the position of Alt keys on PC keyboards), and Meta to
the left of Control. So, the Control key is right under the thumb, and
the Meta is secondary to Control. This is why, the shortcuts for the
most used commands in emacs involve the Control key instead of the
Meta key. (e.g. The cursor movements: C-p, C-n, C-f, C-b, C-a, C-e,
the cut/paste/undo C-w, C-y, C-/, the kill-line C-k, the mark C-SPC,
the search C-s.) Lisp Machine's keyboards fell out of use alone with
Lisp Machines. Since the 1990s, the IBM PC keyboard↗ (and its
decedents) becomes the most popular and is used by more than 99% of
personal computers today. The PC keyboard does not have Meta key but
have Alt instead, which is practically used as Meta for emacs. The
Ctrl and Alt key's position are essentially swapped from the Control
and Meta on the Lisp Machine's keyboards. Emacs however, did not
change its keyboard shortcut set by switching the commands that are
mapped to the Control and Meta keys. This makes emacs keyboard
shortcuts very painful, and the frequent need to press the far-away
Control key makes the Emacs Pinky syndrome. (Many emacs-using
programer celebrities have injured their hands with emacs. (e.g.
Richard Stallman↗, Jamie Zawinski↗), and emacs's Ctrl and Meta
combinations are most cited as the major turn-off to potential users
THE CHOICE OF KEYS
The shortcut's key choices are primarily based on first letter of the
commands, not based on key position and finger strength or ease of
pressing the key. For example, the single char cursor moving shortcuts
(C-p previous-line ↑, C-n next-line ↓, C-b backward-char ←, C-f
forward-char →) are scattered around the keyboard with positions that
are most difficult to press. (these shortcuts all together accounts
for 43% of all commands executed by a keyboard shortcut) Of these, the
most frequently used is C-n (next-line), which accounts for 20% of all
shortcut calls, but is assigned to the letter n, positioned in the
middle of the keyboard, which is one of the most costy key to press.
Similarly, the second most used among these is the C-p (previous-
line), accounting for 16% of all shortcut command calls, is located in
a position above the rigth hand's pinky, also one of the most costy
key to press.
(Here we assumes the QWERTY keyboard layout. On the Dvorak layout, it
is about as bad.)
A significant portion of emacs's major shortcuts (those with M-«key»
or C-«key») are mapped to commands that are almost never used today.
Some of these occupies the most precious space (Home row with Meta:
e.g. M-s (center-line), M-j (indent-new-comment-line), M-k (kill-
sentence)). Most programer who have used emacs for years never use
these commands. For example:
digit-argument, M-1 to M-9
M-g prefix, M-g
NO EMPLOYMENT OF THE SHIFT KEY
For historical reasons, emacs do not use any keybindings involving the
Shift with a letter. (e.g. there's no “meta shift a”, or “control
shift a”) This is so because in early computing environment, such key
combination cannot be distinguished, due to a practical combination of
ASCII↗, Computer terminal↗, telnet↗.
Today, however, employing the Shift key as part of a shortcut with
other modifiers is common and convenient. For example, on Mac OS X,
Undo and Redo are Cmd+Z and Cmd+Shift+Z, Save and Save As are Cmd+S
and Cmd+Shift+S. On Mac and Windows, moving to next/previous field/
window/application often use the Shift key for reversing direction. In
text editing on both Mac and Windows, a modifier key with a arrow key
will move cursor by word/paragraph, and with Shift down will select
them while moving.
Using the Shift key as a reverse operation is very easy to remember,
and doesn't take another precious shortcut letter. By not using the
Shift key, commands with a logical reverse operation necessarily have
to find other key space, and overall making the shortcut set more
difficult to remember, or scattered, or more difficult to press.
A FLAW IN KEYBINDING POLICY
Any major software, maintains a guide for the developers about the
choices of keyboard shortcuts, so that the shortcuts will be
consistant. Emacs has this in its Emacs Lisp manual: Elisp Manual: Key-
This guide, indicates that the only key space reserved for users to
define, are the function keys F5 to F9, and key stroke sequence
starting with Ctrl+c followed by a single letter key.
This is a severe restraint to the utility of customized shortcuts. F5
to F9 are only 6 keys. The key sequence starting with C-c followed by
a letter, is a difficult sequence to execute, and there are only 26
The function keys, F1 to F12, are very good candidates for user
defined shortcut space, similarly for the digit key shortcuts, 0 to 9.
These series of key space can be multiplied by any combination of
modifiers of Control, Meta, Shift. For example, a user might define
the them to insert various templates, headers/footers, a system of
customized HTML/XML tags. Or, she might assign them to various special
emacs modes such as dired, shell, ftp, email, calendar, calc,
*scratch*, make-frame-command (Open a new window), insert signature.
It seems too drastic a policy, to limit user defined keys to only F5
to F9, and key sequence of Control+c followed by a single letter key.
EPILOGUE: FAILURE TO CHANGE
Today, most commonly used keyboard shortcuts have been somewhat
informally standardized. For example, C/X/V is for Copy/Cut/Paste. O
is for Open. S is for Save, Shift-S is for Save As. P is for Print. F
is for Find/Search. Tab is for next, Shift tab for previous. These are
common conventions today in every application across Microsoft Windows
and Macintosh (and most Linuxes).
These shortcuts conventions are primarily brought about by Apple
Computer Inc's Human interface guidelines↗ and IBM's Common User
Access↗ in the 1990s.
In the early 1990s, DOS era software, each application has its own
scheme of shortcuts. The following is a excerpt from the Wikipedia
article on Common User Access↗:
CUA was a detailed specification and set strict rules about how
applications should look and function. Its aim was in part to bring
about harmony between MS-DOS applications, which until then had
implemented totally different user interfaces.
* In WordPerfect, the command to open a file was [F7], .
* In Lotus 1-2-3, a file was opened with [/] (to open the menus),
[W] (for Workspace), [R] (for Retrieve).
* In Microsoft Word, a file was opened with [Esc] (to open the
menus), [T] (for Transfer), [L] (for Load).
* In WordStar, it was [Ctrl]+[K]+[O].
* In Emacs, a file was opened with [Ctrl]+[x] followed by [Ctrl]+
[f] (for find-file).
Some programs used [Esc] to cancel an action, some used it to complete
one; WordPerfect used it to repeat a character. Some programs used
[End] to go to the end of a line, some used it to complete filling in
a form. [F1] was often help but in WordPerfect that was [F3]. [Ins]
sometimes toggled between overtype and inserting characters, but some
programs used it for “paste”.
Thus, every program had to be learned individually and its complete
user interface memorized. It was a sign of expertise to have learned
the UIs of dozens of applications, since a novice user facing a new
program would find their existing knowledge of a similar application
absolutely no use whatsoever.
Commercial software have updated themselves with time (or went
extinct), but emacs has not.
xah at xahlee.org
More information about the Python-list