Emacs + Keyboard Geeking, the Nth Episode 2012-03

, ,

Just spent ≈4 hours and did major surgery on my keyboard system again.

specifically, the change is this:

Before, the 【▤ Menu+‹key›】 combo insert various Unicode chars, and Caps Lock does emacs's “execute-extended-command” (M-x). Now, the two are switched. Now the ▤ Menu key does “execute-extended-command” (just like on Linux by default), and 【Caps Lock ‹key›】 inserts Unicode chars (note it's a key sequence here, not combo.).

Also, Esc now does emacs's cancel 【Ctrl+g】. And, 【Ctrl+Esc】 does Esc.

The mappings are done using AutoHotkey and emacs. Here's related references and tutorials:

Note that all my {F1, …, F12} function keys are used up. All 15/17 keys on the numberpad are also used up (the exceptions are Num Lock and Enter ↵). All 9 app launch special buttons on the keyboard are also used up. Some of these keys are used globally, some are app specific. If you have empty function keys, you should make use of it NOW! 〔☛ Increase Productivity Using F1 … F12 Keys

here's a summary of my keyboard shortcut design principle.

wrote much about this already here: Keyboard Shortcut Design: Dedicated keys, Special Buttons, Extra Keys.

for some reason, i've always loved keys, and efficiency. Got a Brother electric typewriter in ≈1986. (First computer use is ≈1990. My first computer is ≈1991.) Was QWERTY typist. Switched to Dvorak ≈1993. Wrote my own Dvorak layout for Mac OS using ResEdit, ≈1993. Use QuicKeys from ≈1992 to 2002, and had IJKL keys as cursor movement. First emacs use ≈1998. Live in emacs starting 1999. From 1999 to 2005, i use default emacs keys, and use emacs in text terminals exclusively. Have always explored all keyboard shortcuts in every OS/App i've used. ErgoEmacs keybinding started in 2007. Starting in 2007, i got really heavy with keybinding design and spend hours every month, studying, thinking, researching, tweaking, keys. LOL. The experience is sometimes frustrating, because the keyboard itself is so badly designed 〔☛ Keyboard Hardware Design Flaws〕, and then ALL the keyboard tools, counting emacs and {Windows, Mac, Linux}, all have quirks that doesn't let you do certain bindings. So, when thinking about optimal key placement, you have to consider lots aspects. (preferrably, you want your bindings to work on all OSes, and on all keyboards (⁖ some don't have ▤ Menu key or RWin key, then there's Difference Between Apple & PC keyboards.), and also generally compatible with existing conventions, minimize using advanced features of keymacro utils (because some key combo won't work in another OS).), and then muscle memory change is a pain. So far, i haven't explored much of Linux's keyboard system. Did spent a month on linux last year. The keyboarding issues there isn't roses.

Here's 2 lines i added to my AutoHotkey:

#IfWinActive ahk_class Emacs

CapsLock::Send ^2 ; call Ctrl+2
Esc::Send ^g ; call C-g

The 【Ctrl+2】 in MY emacs customization is a prefix to commands that insert unicode.

Why Do I Make These Changes?

Why do i make these changes? The advantage are:

① Before, i have Caps Lock for “execute-extended-command”, now it's ▤ Menu. This is good because it reduces complexity in my setup, and is more compatible to convention (on Linux). It reduces complexity because in order to set Caps Lock i had to use AutoHotkey. But to make ▤ Menu do M-x, i can just do it inside emacs: (global-set-key (kbd "<apps>") 'execute-extended-command), supported across emacs platforms. As to the advantage of these 2 choices without considering complexity of implementation, i think they are about equal. (here, assume you are using one of Microsoft's ergonomic keyboards, which has big Menu key right under right thumb. On most PC keyboard, there's also the Menu key. In general, the Menu key can be pressed by thumb or knuckle. While Caps Lock is left pinky. On the whole, i consider them about ergonomically equal.)

② Before, i press 【▤ Menu+‹key›】 combination to insert about 30 different Unicode symbols and brackets by pair, including the normal parenthesis. Now, it's 【Caps Lock ‹key›】 SEQUENCE. This is BIGGISH ergonomic improvement. But it also, reduced implementation complexity somewhat. Because, now i don't need to set up Hyper key in emacs. Now, in AutoHotkey i set ▤ Menu to send 【Ctrl+2】, then in emacs 【Ctrl+2 ‹key›】.

③ The Esc for emacs's cancel 【Ctrl+g】 is a no-brainer. Emacs's 【Ctrl+g】 is used often, involves a combo. Depending how much your fingers actually dance in emacs according to keylog. If not much, then 【Ctrl+g】 is better than Esc because it require less whole hand movement. But as your type duty gets beyond a point, single keys are always better. I'm tired of pressing key combinations all day. (Note: {Windows, Mac, Linux} all have sticky keys feature, but turning it on is not optimal, because it introduces a whole lot of complexity (it merges between key combinations and key sequences, both used heavily in emacs) and also slows you down significantly.)

What Keyboard You Use and How Much You Type, Really?

Note: when we talk about keybinding, keyboarding habit, etc, it's important to say what keyboard one actually use, and how much one really types (from stat of a keylog). Otherwise, there's a lot miscommunication in online forums. One person says X, another can't see how X would be good, and it turns out one is using laptop keyboard and another fancy Kinesis, etc.

Also of interest is how much one really types. We often hear “I sit on computer 10 hours a day for n years, and i think the keybinding/keyboard should be this or that way”. We coders all sit in front of comp all day. I did a calculation from my keylog last year to see how much i really typed. I was surprised to find that i actually type only 17k keystrokes a day, and that's only about 70 minutes per day if we use 50 wpm. See: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?.

The keyboard i currently use is Microsoft Natural Multimedia keyboard. My layout is Dvorak.

blog comments powered by Disqus