Ergonomic Efficient Emacs

Use Big Data to Improve Your Emacs Experience

Determining frequently used Emacs commands with complex keybindings and assign short-cuts for improved efficiency.

Writing the title sent a chill down my spine. I am tired of the masses of articles à la “Using Big Data to Solve This and That Problem”. Yeah, a significant number of people use the internet nowadays and have lost any concerns about companies reaping tons of from them. So we can do things that we could have done 10 years ago already, if we had had the data. Got it. Let’s all curiously wait for the next buzzword.

But let’s ditch that cynicism and the obviously tongue-in-cheek title such that we can talk about something more uplifting: Emacs – ah. Well, recently I came across key chords for Emacs. It allows you define keybindings where you press two keys simultaneously (e.g., “ab”) or a single key twice (e.g., “a a”) to invoke a function. If you are using default key bindings like C-c . l a frequently, you may want to consider switching to something more wieldy. Key chords may help against the Emacs pinky. For a simple estimate, let’s assume that we can effectively use 43 keys for chords, then this gives us

possibilities. Good enough!

Okay, so let’s start replacing the intersection of unwieldy and frequently used keybindings. In a language essential words such as the are typically short (compared to hippopotamus). Similarly, in Emacs the essential commands like C-n are good enough already as well. So what’s missing for our optimization is a tool to gather the frequency of command usage (i.e., (interactive) commands I presume). While I put it on my TODO list recently to write such a tool, a quick search for frequency on (list-packages) reveals that such a package already exists and its name is keyfreq. All not that surprising. So we add

(use-package keyfreq
  :config
  (keyfreq-mode 1)
  (keyfreq-autosave-mode 1))

to our .emacs file, we do some work and export the data to HTML via (keyfreq-html). Now we can go through the list and assign key chords. Done.

Oh, did I mention that you should use the package use-package to clean up and improve your .emacs?

Post a Comment

All comments are held for moderation; Markdown formatting accepted;
By posting you agree to the following privacy policy.

This is a honeypot form. Do not use this form unless you want to get your IP address blacklisted. Use the second form below for comments.
Name: (required)
E-mail: (required, not published)
Website: (optional)
Name: (required)
E-mail: (required, not published)
Website: (optional)