The Roadmap to Completely Replace Emacs Key System, Part 1

By Xah Lee. Date:

did massive update on the ErgoEmacs Keybinding. It's dev version. Probably has bugs. More change coming in following days or weeks.

made a few new discoveries about keyboarding habit and health this week. Don't know where to begin… but i'll just start to ramble here. You can read on or just get the files there any try it. Read the history file there. More change will be done in next few days.

Ok, following will be rambling.

Repetitive Strain Injury and the X S Keys

(in the following, i'll use QWERTY to indicate key position, even though i use Dvorak.)

My left hand is faaked. emacs. Wasn't sure what's causing it. Now i know. It's the keys that require using 4th and 5th fingers, while hand is in standard touch-typing position. Actually, mostly the undo z, cut x keys, and that standard save select all (s, a).

Here's a new thing i've learned. Normally, it's a good advice to press key chords using both hands. That is, suppose you want to press Ctrl+x. You should use right hand to hold right Ctrl and left hand to press x. For touch typer, this means you press the x with 4th finger. This'll cause major problem if done often.

Solution: set {F1, F2, F3, F4} keys for undo cut copy paste.

there's lots of tricky details. Normally, for those who use CapsLock for Ctrl, this particular issue doesn't happen, because you shift your left hand and make your left hand into some spider leg way to press Ctrl+x. So, x is pressed by either 2nd or 3nd finger, both strong fingers. (though, i think given equal amount of typing, this method may develop other problems.)

also, there are certain things that made this issue worse: in about a year ago, a new feature is added to ergoemacs keybinding. That is, when there is no text selection, pressing cut or copy will simply cut/copy the whole line. (See: Emacs: How to Copy/Cut Current Line.) This is really a fantastic feature by itself. But there's a odd consequence. With this new feature, i noticed that i no longer use kill-line anymore. I simply use cut, which will cut the current line nicely. Also, when i need to cut/delete multiple lines, normally you mark, then move cursor, then cut or delete. But i noticed i don't do that anymore. I simply just cut multiple times, sometimes holding the cut key. Nice! Convenient and saves keystrokes. But the problem is, that my 4th finger now press the x key, many many times. In other words, indirectly, i'm putting a whole lots burden on the 4th finger.

If i was hunt'n'peck, that may not be a problem because i just use index finger to peck x. But since i am touch-typer, and tend to follow proper ways, so to press x, i use 4th finger while whole left hand is in standard position. This is the cause of my problem. Normally, standard typing won't type x much.

i find this particularly interesting, because seemingly good methods may create side effects that's bad.

Home Row Key ≠ Good Health Key

Summary: Home Row key isn't necessarily good health key. If you want to assign score for each key with respect to health, then the worst are Z X A S keys (and same for right hand). (easy way to see this: Type “asasas…” continuously for a hour. Then type “rfrfrf…” continuously for a hour. Although {a, s} are both on home row, while {r, f} has only one key in home row and require finger travel, but “asasas” is much higher risk of RSI.)

also, in past week, spent days to think/search on what's the problem. Sometimes i think typing too much IS the problem, period, regardless all other health measures. That is certainly true to some degree. When you need to type more than certain load for years, you'll get problems regardless how good are the typing habits, keyboard, or personal health etc.

Sequential Key Strokes vs Key Chord

but anyhow, in past week's thinking, i came up with the thought of eliminating all key chords. I've been on this road in recent years, but this week i made a more systematic approach, and added 30 or so sequential keys with the F key. By my analysis, i think sequential keys are much superior than key chord in many ways. Health, memorization, grouping… and i think even faster to operate on the long run on average. Here's a draft of reasons:

Advantages of sequential keys

so, i've been using a draft system for a few days now. Been thinking to go thru the whole ~200 C-x keys to give them a sequential key, and make it part of ergoemacs. But that'll take months to design.

the one thing sequential keys can be faster is that, for example,Ctrl+x r k of kill-rectangle; you want to make the most frequently used commands to have the most easy keys. In this case, that key can be F7 F8 8. So, 3 keys all nearby.

but Ctrl+x r k is easier to remember? Not necessarily. If you look at emacs's Ctrl+x r key, you'll find it's a mixed bag. Some are about bookmark, some rectangle, some registry. While, F7 F8 prefix can all be about rectangle commands. So, this is a example that i think sequential keys may not be worse with respect of ease of memorization.

but also, when it comes to keys, ease-of-press is more important than ease-of-memory. Because, once you know the key, you have to use it for the rest of your life. Also, the memory is muscle memory, not verbal citation of key sequence. When asking what's the key for a command, most emacs users may have difficulty, but will easily execute it by the fingers.

so far, the system is such that for most frequently used commands, they'll have one single F key. For example: F2=Cut, F3=Copy, F4=Paste, F5=Undo. Then, Secondary frequently used ones will have 2 keys, start with a F key then a number. For example: F7 5 for list-matching-lines. F7 6 for rect kill, F7 8 for rect yank, etc etc. Then, others will have 3 keys, for example, F7 F6 5.

principle: 1 to 3 keys. The first few are always F keys. The last is digit or letter. (this makes it actually easier to remember than C-x, or C-c prefixes… many of them are more prefixes. Which is prefix is not predicable.)

Currently, the plan is that F6 to F9 are all prefixes. If we only use these 4 F keys, in our system, we'll have a total of 4*40+4*4*40 = 800 keys. Pretty much covers any need. (any emacs user, even advanced expert, probably use less than 200 keys.) (GNU emacs by default has about 650 usable keys. See: A Curious Look at Emacs One Thousand Keybindings.)

also note: chord keys are still necessary, because they can be held-down to repeat the command, but a key sequence type of hotkeys can't. Any command that makes sense to be called more than once within 1 second, must be chord keys. For example: moving cursor, page up/down, undo, redo, paste, isearch-forward, where you can hold it for repetition. (one single F key can also work, but there are not enough F keys for that, and plus F keys needs reach) So, these should be covered by Ctrl+key or Alt+key.

Conversely, i think a principle of this is that if a command never needs to be called twice within a second, then it shall Not have one of Ctrl+key or Alt+key. That is, the chord keys will be exclusively for commands that may need to repeat by holding key. (many keys in emacs default violate this. For example: query-replaceAlt+%】.) This way, we maximize the key space for any commands that can use holding down. While, once-off call commands such as

will use the key sequence.

also, been thinking to abolish any key that needs pressing 3 keys simultaneously. For example: emacs default regex replace, or lisp code navigation keys.

btw, this note apply to really heavy typers. there are huge number of misconceptions about typing. I have brushed with RSI in past years. Never seriously enough to experience pain, but seriously enough to do something about it. (tingling sensation, sore, etc. This time, it's soreness in forearm) About 2 years ago, there's a incidence of tingling, pretty bad. Blogged about that here: Programer Hand Health: vi Esc Key Syndrome, Emacs Repetitive Strain Injury, My Experience. In summary, that problem is caused by frequent side-to-side wrist motion. (like vi, reaching for esc) It was my bad habit of reaching for the 1 and ` key. This has since been corrected, but it's so interesting that today i developed other issue.

typing is such a complex and subtle thing… here's a blog i wrote that covers some common misconceptions of typing. It's a draft version, in bad shape… but anyway here it is Bad Advice on Typing and Keyboard from Programers

this post is quickly written. I just want to get it out. Will edit and refine later. I actually typed the whole thing, lol, my hand didn't break (lol). Feel free to post your thoughts, even if disagree. Emacs keys needs to be based on scientific basis as much as possible, and it can be done…

PS check out the ergonomic keybinding update, give me your input. Thanks.

The Roadmap to Completely Replace Emacs Key System, Part 2

After 6 months, i gained more experiences and understanding. See: The Roadmap to Completely Replace Emacs Key System, Part 2

for a programer, as much as 70% of your typing is calling editing commands, not data entry.

that means, it's not QWERTY that wreck your hand. It's the emacs keys.

See: Emacs's Command Frequency.

Completely Replace Emacs Key System

This leads to a key system that completely replace emacs's system. This i've been thinking for a few years now. But today, it seems i actually arrived at a sensible map. Here's a summary:

• First, start with ErgoEmacs Keybinding. This will take care of some 80% of key health issues.

• The ▤ Menu key will be emacs M-x. Single key. There will also be a chord key for this, provided in the rare situations when people don't have the ▤ Menu key. Currently, it's Alt+a in ErgoEmacs keybinding. There probably should be a single F key. (For example, Mac users). Possibly F10.

F2=Cut, F3=Copy, F4=Paste, F5=Undo.

• The Ctrl+x key group will be mapped starting with a function key. Currently, the plan is F8.

• The Ctrl+c key group will be mapped starting with a function key. Currently, the plan is F9.

That leaves with emacs Ctrl+h. But lucky for us, emacs already has F1 as equivalent.

The above is the sketch of the design. It's pretty much all already been implemented in ErgoEmacs keybinding. (except the C-c = F9 issue, probably due to a emacs bug, but we'll not discuss that for now)

What is really new, is to design the actualy F key sequence for each and every of GNU Emacs's 1000+ Default Keybinding, based on the principles in this article and that of ErgoEmacs. Also, the principles of this article is subject to change. The work will needs lots stats and experimentation.

I'll probably be working toward this, slowly, in coming months or years.

The Roadmap to Completely Replace Emacs Key System