Emacs, RSI, My Experiences

,

Recently, i had starting symptoms of RSI (repetitive strain injury). (For detail see: Programer Hand Health: vi Esc Key Syndrome.) This page is some practical emacs and keyboarding advices i learned from this experience.

Keyboarding Advices Are Qualitatively Different Depending on Typing Duration

I learned that typing advice matters depends on just how much you types a day.

We all sit in front of the computer all day, but if you log you keystrokes, you may find that you only type less than one hour a day if done continuously. Contrast this to data-entry clerks, who actually type, continuously for several hours a day. 〔☛ How Many Keystrokes Programers Type a Day?

If you just type less than 1 hour a day, QWERTY or bad habits or bad keyboard is completely healthy! You could do this for 10 years and never have any problem. If your typing comes near data-entry clerks, a special ergonomic keyboard such as Kinesis or Maltron becomes necessary.

Tab, Enter, Backspace Key are Problems

I learned that the PC keyboard really have serious problems especially with the Tab ↹, Enter ↵ keys, ⌫ Backspace, and the right side ⇧ Shift key. Even with Microsoft's ergonomic keyboards.

They are all pressed by stretched pinky. The Enter ↵ and right ⇧ Shift requires a stretched pinky because there is 1 extra key after the right pinky's home position. (the apostrophe ' key.) (Some European language layouts such as QWERTZ and AZERTY have 2 extra keys in between!)

This is the first time, that i realized from actually hand experience, about the problem of these keys. To press Enter ↵ or right ⇧ Shift, the right hand does a combination of stretching pinky or side-to-side wrist movement. Do this for 8 hours a day every 5 seconds; hello RSI!

One might think these keys are not used that often, but from emacs command frequency study , majority of programers probably do a lot more editing than typing. The average for editing keystrokes is like 48%! (for each person, it varies from 20% to 80%, depending on whether you are for example heavily writing a lot emails, or much reading/editing code.)

(Maltron, Kinesis keyboards solve this problems by having thumb cluster keys for these)

For more detail on this, see: Keyboard Hardware Design Flaws and Kinesis Contoured Keyboard Review and RSI.

Emacs Tips for 70-Hour Week Sessions

The following are some specific emacs advices. Note that i already use:

So, the following advice may be applicable only if you already do the above and have to type 70-hour weeks for many weeks.

• I started to remap extensively my personal bindings that involves a ⇧ Shift. Get rid of them. Especially those needs the right ⇧ Shift. (i.e. the letter is on the left side of keyboard)

• I started to aggressively make aliases to commands i use often. The aliases are 1 to 3 letters long. Put alias file on your Emacs's Bookmark so you can open them right away and define new ones the moment you find a command that you are using a lot today or past days. (i stopped worrying about cluttering alias space or managing to remember them. It doesn't seem to be a practical worry.)

I use aliases because i already have about 200 personal hotkeys. Single key spaces are mostly used up (including single keys on the number pad), key chord combinations are harder to remember.

• Do the same for abbrev, as well as your custom keybinding file. The point here is that you want a dynamic and instantaneous system that let you easily change or add new shortcuts, alias, abbrevs, and you should get a habit of adding new ones whenever you noticed a command or word that you've been using frequently in the past few days. (you will usually notice it. For command, due to the fact you have to press Tab ↹ a lot to command completion (⁖ elisp's “buffer-substring-no-properties”), and for long words like “environment variable” or “internationalization”, “Microsoft”, “Windows”, “GNU Emacs”, “software”, or “http://ergoemacs.org/”, you'll notice.)

• I started to type Enter ↵ by 【Ctrl+m】 half of the time. (in fact 【❖ Win+m】 is also Enter ↵ now thru AutoHotkey.) Partly to alleviate the burden on right hand, partly to vary the muscle usage. And yes, sometimes press Enter ↵ by moving your whole hand, as in hunt-n-peck.

Note, unless you are on a laptop, don't press Ctrl with pinky, and it's probably not a good idea to swap Ctrl with Caps Lock. 〔☛ How to Avoid the Emacs Pinky Problem

• Remapped Caps Lock to Tab ↹ now. (or, i could also use 【Ctrl+i】)

• Seriously started to use yasnippet template system a lot. Made it a habit to create new templates constantly and instantly. Usually with just 1 to 3 letter abbreviations to invoke them. Don't fret about abbrev consistency, template design, etc. The point here is that it's for your personal use, and that it immediately saves you lots of typing.

For example, instead of “div.class” for <div class="…">…</div>, you can make it just “d.c” or even “dc”.

• I realized that Bookmark, dired, all can use mouse. I try to switch to mouse more often. Yes the keyboard is faster but not good if repeatedly used for 10+ hours a day without hand muscle changing exertion pattern. Sometimes also use mouse to select text.

• I started to use less efficient keys sometimes, ⁖ the arrow key and 【Ctrl+arrow】 for cursor movement, page up/down, …. To get hand away from the same muscle usage on touch typing position.

• Alternate hands for pressing the Space bar.

My problem is only with left hand. On Dvorak, right hand actually does 14% more typing. I realized that i always press space with left thumb. Now i switch to right thumb. Perhaps eventually want to develop a habit of alternate hands for space bar after each word. (in human language or computer language, the space occures more frequently than any letter)

• Sometimes i switch keyboards during a day. My 3 fav are Microsoft's Natural Ergonomic Keyboard 4000, Comfort Curve Keyboard 2000, Wireless Natural Multimedia. Right now am on comfort curve, which has laptop style flat keys. Change keyboard is for the purpose of varying the muscle usage pattern.

• In emacs keybinding, forget anything about consistency or ease-to-remember. One principle and one only: map Command Frequency to ease of the key.

• Do not bother with prettying up little formatting in code or deleting a trailing space, alignment. Avoid these extraneous typing. Use automatic formatting tool as much as possible. (⁖ emacs “delete-trailing-whitespace” and much others.)

I don't have a problem using mouse at all, probably because i don't use mouse that much. But anyhow, i find 2 fantastic ways to save clicks:

ErgoEmacs Viper Mode

I seriously considered creating a ErgoEmacs viper mode. I'm familiar with vi's “modal” methods of editing, but have always kinda put off of thinking about whether the vi modal method is more efficient or ergonomic. With my RSI incident, i put heavy thought about it, and i think yes, the modal method is actually more efficient and ergonomic.

I think i'll invest time in this in the future.

(However, note that by default the Esc for switching mode is a fast way to get RSI. Also, the default command keys in vi are NOT optimal. 〔☛ Emergency vi (vi tutorial)〕 Vi's keys, like emacs, are largely historical happenstances without any thought on efficiency or ergonomic. 〔☛ Keyboard Hardware's Influence on Keyboard Shortcut Design (How Emacs & vi keys came to be)〕 )

Kinesis Keyboard

The Kinesis Contoured Keyboard solves many major PC keyboard problems. I think i may get it.

I think the above sums my recent experiences.

Again, this needs to be emphasized: the above advices are from someone who spend on average 12 hours per day in front of computer for the past 2 years. If your keyboard needs is not this heavy, some of the above advices are not applicable, and in fact less efficient (⁖ switching keyboards in a day, constantly add new keyboard shortcuts, use the mouse, etc.)

Also, my heavy use of keyboard is mostly writing essays and tutorials in HTML. So, there's a lot of heavy data-entry tasks (meaning: just keep typing a lot of plain English text.). Because i have extensive shortcuts and commands to insert HTML tags or special chars such as 〈「【([{"=+-"}])】」〉, my typing problem is probably mostly due to heavy typing, not much from emacs chording.

Here's a good discussion on RSI:

blog comments powered by Disqus