Emacs Keybinding Rant, and a Glimpse of Xah Lee's Life 2010
This page is a rant from a online post by me, about 3 subjects: ① why emacs's default keys F3 and F4 for keyboard macro start/end are not good choices. ② what i think are important principles in keybinding design. ③ a short description of my life style.
F3 F4 for keyboard Macro Start/End
Drew Adams 〔drew.ad…@oracle.com〕 wrote:
│ Or use what is already there since 23.1: │ <f3> runs the command kmacro-start-macro-or-insert-counter… │ <f4> runs the command kmacro-end-or-call-macro… It's unfortunate however that two repeatable keys were wasted for these default bindings. Repeatable keys are better reserved for operations that you want to easily repeat by just holding down a key or chord. Yes, you can use `f4' for both ending a macro definition and executing the macro, and the latter operation is repeatable. Still, it is better to use a repeatable suffix on a prefix key for this, for example, `C-x e e e…' (which you can already use as an alternative to `f4 f4 f4…'). Single repeatable keys are a valuable resource and should not be wasted. `f3' and `f4' also do not offer mnemonic help. Consider by contrast the keys bound to `kmacro-start-macro' and `kmacro-end-macro': `C-x (' and `C-x )'. Those bindings were made decades ago (to the parents of the current commands: `start-kbd-macro' and `end-kbd-macro'). They are mnemonic, visually indicating start and end, and they are not easily repeatable by holding keys down. Start/end have no need to be repeatable.
totally agree with Drew Adam here.
i also like add a point about why i think F3 F4 is bad. (maybe Drew agree too or maybe not)
F3 and F4 is one of those easy-to-press keys: single key, big key, in easy-to-access positions. These type of keys are rare. (in the sense that you have some 10 times more commands you want to have easy key in emacs)
in my quite painstaking research about all aspects of keyboard in the past few years, i came to this one single most important principle:
most frequently used commands need to go to most easy to press key spots. [see Keyboard Shortcut vs Launch Buttons]
all other keybinding considerations, such as ease-to-remember, logical placement with similar commands, are in comparison almost unimportant.
in this regard, F3 and F4 are bad keys for kmacro-start-macro and kmacro-end-macro.
In the past Emacs also used the similar keys `C-x [' and `C-x ]' for generating the corresponding Emacs-Lisp code while defining a keyboard macro. I don't recall whether those keys were in Gnu Emacs or some other Emacs from days of yore. The point is that here too mnemonic start/end keys were used, and no repeatable keys/chords were wasted gratuitously. (Yes, it is also true that natural pairs such as ()  \/ and <> are rare and should be used judiciously.) There was some discussion back in 2002 about wasting `f3' and `f4' for this. At first (with no discussion AFAICT), `f7' and `f8' were implemented for it - same problems obviously. A user pointed out that function keys `f5' to `f9' are supposed to be reserved for users to bind, so the macro commands got moved to `f3' and `f4'. What was the main argument for binding kmacro commands to such keys? "I need to bind them to two adjacent function keys" and "it makes a nice interface to have this on two function keys next to each other". Which is no reason at all (why do they need to be adjacent? why do they need to be on function keys?). The other arguments given in support of wasting `f3|4' for this: (a) "I don't see why we should hide an excellent feature like keyboard macros", (b) keys like `C-x (' are "way too cumbersome" for defining a macro, and (c) "I really don't understand why binding function keys by default is worth making a fuzz about". (b) is the most misguided of these: you don't need a quick, repeatable key just to turn on/off keyboard recording. Use easily repeatable keys for repeatable operations (incremental changes, cycling, etc.), and use keys that are a bit more cumbersome for one-off operations such as on/off, start/end. To their credit, Stefan and Miles argued against using function keys for this, but with no success. This was the last word, from RMS: "I think there is no harm in supporting F3 and F4 as well as C-x (, C-x ) and C-x e and C-x C-k, if users like F3 and F4. We could take a poll and ask them." AFAIK no poll was ever taken. Although Stefan's suggestion to use `C-x e e e…' to repeat macro execution was also implemented, `f3' and `f4' remain bound by default, and `C-x e e e…' took a back seat in the doc (and consequently in practice, no doubt), seemingly as an afterthought. There isn't even any mention of the `C-x e' option `kmacro-call-repeat-key'. http://lists.gnu.org/archive/html/emacs-devel/2002-08/msg00760.html
again, i agree with what Drew wrote above.
I think one of the F key should be “execute-extended-command” 【Meta+x】, and 【Ctrl+x】 and 【Ctrl+c】 should also have F keys.
Emacs Keyboard Design
PS off-key but i really love to remark: i use my own ErgoEmacs Keybinding set of course, which completely remap all the primary keys based on command frequency. On top of that, i have over a hundred more personal emacs keyboard shortcuts, and a hundred more outside of emacs. (on Windows, that's AutoHotkey) Also note, sometime i read online (For example, reddit, hackernews) that people remark that my use or teaching of emacs is like from Windoz Notepad newb. Actually, the first 6 years of my emacs using, from 1998 to 2004, is in plain old text terminals (not even XTerm), and absolutely traditional emacs keybinding. I even avoid adding anything to my “.emacs”. (have written amply about this on my site or if one care to research past posts on the net)
… a bit more about keybinding. In the past 3 or so years, due to my obsession of keyboarding efficiency, by steps of piecemeal improvement of my emacs use by *practical* experiences (with emphasis on statistics and science basis as opposed to “i feel” or anecdotes), i realized that i've eliminated all keys that require multi-sequences. A few months ago, the last one to go was kill-rectangle 【Ctrl+x r k】 and string-rectangle 【Ctrl+x r t】. They are now 【Ctrl+8】 and 【Ctrl+9】.
(actually, there are still exceptions. Ι still haven't remapped 【Ctrl+h f】, 【Ctrl+h k】, which i use few times a hour on average. Also, still use 【Ctrl+x (】 and 【Ctrl+x )】 perhaps few times a week. Actually a few more… especially mode specific that starts with 【Ctrl+c】.)
in the past 6 months, i started to wonder if vi's so-called “modal” way is actually more efficient. Am certain of it now. I think it is inevitable that down the road i'll be creating a ErgoEmacs-Viper mode, due to my keyboarding obsession.
Xah Lee Boasts
also, you know how most of us live among tech geeker communities. The internet is my home. My life. And among tech geekers, y'know how harsh it is, that there's always someone who knows more than you, and often not shy to show it. On the net, you often hear linux or emacs geeks brag about their keyboarding habits n setups, such as some Ratpoison or Haskell based tiling windows etc. (n they not shy to tell you about it, and tell you how you should do it this or that way with this or that tools)
I tell you now, and you can quote me on this: i don't care what linux you on, what ratpoison you use, what X11 xmodmap you've done, how extensive your customization is, how many decades of emacs you've been using: my setup n system, is more efficient than you, by any means of scientific assessment.
AND: i don't care if you are Richard Stallman or old time emacs dev. The total time i spend in emacs, in past 3 years, is more than you have. (if you think you can challenge that, first ask ur self if you LITERALLY sit in front of the computer for 14 hours DAILY on average in the past 3 years, STATISTICALLY speaking. If not, forget it. If you have a family, forget it. If you watch TV, go out to dinner, or occasionally go to bar or social events such as movies, forget it. If you work in a day job (with meetings, time spend on driving, etc), forget it. If you take shower daily, take time to cook diner, or go to gym, forget it. If you hang out with friends, or chat with room-mates, forget it. Now, if you are city hermit, a ascetic, a extreme weirdo, like me, then, possibly we can compare notes. Otherwise, you can forget about challenging me on things i say forcefully.)
(the above paragraph speaks of last 3 years. But the pattern is about the same for past 20 years, just more severe in past 3.)
with respect to emacs keybinding, emacs should completely ditch the C-x. Not by simply turn on cua-mode, but re-write the entire shit, axe the cua-mode hack. Stop the C-m C-i to Enter Tab equivalences. Support the 7 or so standard keys such as Open, Close, Copy, Paste. Re-design the whole major shortcut keys. (For example, cursor movement, text deletion.) (adopt my ErgoEmacs keybinding design if u want.) This will not only make emacs compatible to current standards (For example, for those Windows noobs we love to hate), but also much more efficient for the most hard-core tech geekers (For example, what u'd call “hackers” such as many here).
for each point i made in this post, i have written a essay with hundreds words details. They are all on my website. I shall not make any links here.
Also, a disclaimer: i claim exactly what i've written as they can be reasonably interpreted. With all the bragging, i do not claim, for example, that i know more elisp than many here, nor that i'm a better programer, etc.
i guess it is old school netiquette that when flaming is over, one makes a note of it. But no, the bragging has only began!
No U! It's Me!
Xah ∑ http://xahlee.org/
This article is originally a post to gnu.emacs.help at Source groups.google.com
For subsequent discussion, see:
Patreon me $5. Ask me question on patreon