Pinky and the god: Avoiding Emacs-induced RSI

Published on 2014-06-24
Tagged: emacs

View All Posts

Time for a story.

About a year and a half ago, I started noticing some pain in my left pinky finger. This was almost certainly due to heavy use of Emacs, which requires me to hold Control to do almost anything, other than typing text. On my keyboard, as on most keyboards, Control is on the bottom left corner, which is a bit of a reach. I can't press straight down on it either without moving my whole hand, so I end up pressing down at an angle, which is probably really bad.

I tried Vim for a couple days, but I couldn't get the hang of it. I think Vim, like Emacs, requires the commitment of a couple weeks to really learn the keys and build muscle memory. Plus, I didn't want to leave behind all of my random Emacs customizations. If only there were some way to keep using Emacs without holding Control...

The birth of pinky-mode

I read a lot of blogs and wikis on how to avoid "Emacs pinky". Here's one that, among other things, suggests juggling. I eventually found a blog (which I unfortunately couldn't locate again) that demonstrated navi-mode, a small minor mode for keyboard navigation. Once activated, you could just press letter keys to move around the buffer. Then you could press i to go back to inserting text, like Vim. It was pretty limited though, and I think the key bindings were from Vim, but it was close to what I wanted.

I used navi-mode as a template to write my own pinky-mode. You can activate pinky-mode with any key binding of your choosing. I use the jk key chord (press j and k at the same time) with the key-chord package. Once activated, as with navi-mode, you just press letter keys to navigate and perform common editing functions. Here's a list of key bindings:

iLeave pinky mode

pinky-mode also integrated with the window-number package; you can press a number key to switch to a particular window in the current frame.

When pinky-mode is active, the cursor changes to red (indicating that typing won't insert text). It also shows the word "Pinky" in the mode line. When inactive, it changes to green. You can customize that to work with your color scheme, of course. pinky-mode is global and applies to all windows and frames, but it deactivates temporarily when you go to the minibuffer. It's the kind of behaviour that you don't really notice, but it's really annoying if it's not there.

The open sourcing of pinky-mode

I've used pinky-mode for the last year and a half and absolutely love it. The pain in my pinky has completely gone away, and I didn't need to buy any crazy foot-pedals for my keyboard. I think I use it more than any other piece of software I've ever written.

I finally decided to open-source it and contribute it to Melpa, a really good unofficial Emacs package repository.

Contributing to Melpa was actually really easy, and I encourage any elisp hacker that wants to share something useful to try it. Basically, I just added some comments to pinky-mode.el to make it follow the Emacs package format. I uploaded it to a new Github repository. Then I forked the Melpa repository, added a recipe, checked that it compiled, and sent a pull request.


Steve Purcell, one of the maintainers of Melpa, got back to me a few hours later. It turns out there is another package called god-mode, which does almost the exact same thing. It is written by Chris Done, who wrote a blog post introducing it.

god-mode seems more complete and polished than pinky-mode, so I withdrew my pull request.

It's disappointing, since pinky-mode is something I use a lot and really like, and I wanted other people to use and like it, too. Ultimately though, I think software is about making our lives easier, and introducing a lower quality version of something that already exists would not serve that purpose. It makes more sense to standardize and improve the best solution.

To conclude, definitely try out god-mode if you have pinky problems. If you're using Emacs 24 and haven't set up packages already, add this to your .emacs file:

(require 'package)
(add-to-list 'package-archives
  '("melpa" . "") t)

Then run M-x list-packages and pick god-mode from the list to install it. You can follow the instructions in Chris Done's Github repo to activate and customize it.

Happy hacking!