Emacs M-key Notation vs Alt+key Notation
Emacs should adopt the “Alt+key” and “Ctrl+key” notation throughout its documentation. (as opposed to emacs's “M-key” and “C-key” notation)
In both Windows and Linux's documentations, they use Alt+key and Ctrl+key notation. Windows and Linux account for about 95% of computers used world wide.
Identical to Key's Label
The word “Alt” and “Ctrl” are the exact labels printed on the keys of PC keyboard. More than 99% of keyboards sold today are PC keyboard.
Using a notation that contains the actual label on keyboard's keys is much easier to understand. A beginning computer user, can read the “Ctrl+key” notation and figure out which keys to press. Emacs's notation of “M-key” and “C-key” requires a learning step. Even though it is a minor one, but it adds complexity, especially because emacs has already huge number of non-standard user interface, 1970's outdated terminologies, and huge number of features.
(Apple's computers, which account for about %4 market share today, also use a notation where the name or symbol appears on the labels of Apple keyboard's keys exactly. (OS X's documentation uses the notation “Command-key” and “Option-key”. Application's menus shows them as “⌘key” and “⌥key”. Both the word “Command” and symbol “⌘” appear on the key's label, same for “Option” and “⌥”.)
Meta is Alt in Practice
By default on all major operating systems in use (Windows, Linux, OS X), emacs maps its Meta to Alt key. So, practically speaking, the Meta key is the Alt key.
Keyboards Don't Have Meta Key Today
The Meta key was one of the modifier key on lisp machine keyboards in the 1980s. The lisp machine and keyboards have been obsolete since early 1990s. (for photos and detail, see: Why Emacs Keys are Painful.)
There is practically no keyboard today that has the Meta key. Sun Microsystem's keyboard has a key labeled with a symbol “◆” called diamond. Sun's official documentation refers to this key as Meta key. Sun's keyboards have a market share perhaps less than 0.001%.
Here's a more precise description and clarification on exactly what is proposed.
- Change all notations of M-key and C-key in emacs manual to Alt+key and Ctrl+key notation. Just to be more precise, the source of emacs manual is the texinfo source code, which are plain text files. It generates the info files.
- Change somewhere in elisp source code, so that graphical menu shows the “Alt+” and “Ctrl+” notation.
- Change somewhere in elisp source code, so that doc string (
describe-mode) uses the “Alt+” and “Ctrl+” notation.
Note that this suggestion does not call changes in elisp keymacro syntax, nor any change of elisp function such as “kbd”.
Questions and Answers
How many Emacs users do you know who, beyond their first day or two of Emacs use, have difficulty with the term Meta? I know of none, and I think only you who is irritated by it.
We can look at the situation from the other way. For each such convert, there are perhaps one hundred more people, who simply looked at emacs for 10 minutes, and refused to look at emacs again for the rest of their programing career.
Adopting the 【Alt+key】 notation will create confusion in elisp's keyboard macro syntax. User will ask, why is Alt key represented by “M-” and not “A-”?
The Alt+key notation makes emacs easy to use for beginners.
For advanced users who want to do custom keybinding, they can easily understand that the syntax “M-” stands for Meta and is by default mapped to the Alt key.
(Emacs diehards like to say, that if user can't understand “M-” for “Alt+”, then the user shouldn't use emacs. To quip: if someone interested in elisp get confused that “Alt+” is represented in lisp code as “M-”, then he isn't fit to code elisp.)
Lisp itself has lots of un-fixable baggage in its key macro syntax. For example, there's also Hyper, Super, with syntax
s- (Shift is
S-). These keys are remnants of the Symbolics LISP Machine's keyboard in the 1980s, and don't exist in any keyboard today. [see Keyboard Hardware's Influence on Keyboard Shortcut Design (How Emacs and vi keys came to be)] (but you can bind them just like Meta, of course).
Further, there are quite a lot complex variations of the keyboard macro syntax. Here's a example of equivalent syntax for binding the Enter key:
; equivalent code for a named special key: Enter (global-set-key "\r" 'cmd) (global-set-key [?\r] 'cmd) (global-set-key  'cmd) (global-set-key [(13)] 'cmd) (global-set-key [return] 'cmd) (global-set-key [?\^M] 'cmd) (global-set-key [?\^m] 'cmd) (global-set-key [?\C-M] 'cmd) (global-set-key [?\C-m] 'cmd) (global-set-key [(?\C-m)] 'cmd) (global-set-key (kbd "RET") 'cmd) (global-set-key (kbd "<return>") 'cmd)
It is likely that half of emacs developers, can't explain fully every variation above in exacting detail.
There's also some syntax that compile but has no effect:
(global-set-key (kbd "M-S-b") 'cmd) ; compile but no effect
In summary, if we adopt Alt+key notation in manuals and menus, i do not think it introduces any confusion when it comes to the elisp coding or emacs customization related to keybindings. I think it actually makes it simpler. The logic would be like this:
- There was a Meta key in emacs history.
- PC keyboards, by default, the Alt key will send the Meta signal.
- The keyboard macro syntax for the Meta key is
It shouldn't change because i can press “Esc key” for “M-key”, and it is quite useful in terminal.
The proposed change is about notation, not about keybindings. You can still use these equivalent keys.
For those curious, besides 【Meta+key】 and 【Escape key】 equivalence, there is also 【Ctrl+[ key】. These equivalences are more as by-products of emacs's keybinding implementation technicalities and emacs's historical baggage, not exactly as conscious design decisions.
For example, the reason 【Escape key】 and 【Meta+key】 shortcuts are equivalent is historical. By the way emacs implements keybindings as intercepting key presses as character streams, they have the same binary representation. (this is in the 1970s, of ASCII and terminals)
Other examples of such equivalence includes: 【Ctrl+m】and Enter, 【Ctrl+i】 and Tab. These equivalence actually create problems. For example, user cannot easily re-assign the 【Ctrl+i】 shortcut without effecting the meaning of Tab key. (it can be done, but involves detailed knowledge of elisp and convoluted workaround.)