Emacs's Command Frequency (Old)
2010-02-13. This file is obsolete. For the latest version, please see: Emacs's Command Frequency.
This page lists emacs's commands in the order of their frequency of use.
In emacs, each key press actually calls a command. (For example, pressing
“a” actually calls the command
calls the command
. Pressing Alt+x calls
Pressing the → calls
The motive of this study, is in designing a ErgoEmacs Keybinding. I needed to know which command are actually more frequently used, in order to give it a easier-to-press keybinding.
The following frequency list is based 3 users. Xah Lee (me), Marc Shapiro, Rick Bielawski (aka rgb). The total count of all command calls is 203118. The following is a break down of each's data contribution:
The total count of self-insert-command calls is 65 496. The following is a break down by that command.
Following is a table showing the proportion of each person's use of data-entry commands and non-data-entry commands. “data-entry” commands are the commands: “self-insert-command” (invoked by pressing a single letter/number/symbol key), “newline” (invoked by Enter/Return key). Basically, data-entry commands are just typing. All other commands are considered “non-data-entry”.
A higher percentage of non-data-entry commands probably means that the person is doing a lot editing, as opposed to writing. (if a person uses emacs for email or IRC chat, she's likely to have high percentage of data-entry commands.)
Commands that are executed by the same key are grouped together. For example, the commands “delete-backward-char”, “backward-delete-char-untabify”, “python-backspace”, “cperl-electric-backspace” are all just the “Backspace” key.
The following is the complete list of commands that are merged.
For clarity, some commands are replaced by a glyph. Here's the complete list:
Command Frequency Table
Total number of command calls: 203118
Percent of non-data-entry command calls: 67%
|(lambda nil (interactive) (scroll-up 1))||1095||0.54|
|(lambda nil (interactive) (scroll-down 1))||410||0.20|
|(lambda nil (interactive) (mark-sexp -1 t))||218||0.11|
How The Report Is Compiled
Here we describe how the report is generated. Each person, uses this emacs code: command-frequency.el, which will accumulate a keyed-list of all command the user calls in emacs, with key being the command name and value being its count. After some time, the user calls command-frequency-display which will write the stat into a buffer, then the user save it to file.
The raw data files used in this report are here: command-frequency_old.tgz
A Python program command-frequency_v1.1.py, is used to parse these raw data files. The program aggregate all user's raw data, then groups some commands together as described in this report, and replace some command names by a corresponding glyph, and print them in HTML table format. Commands used less than 0.1% of total non-data-entry commands are not displayed.
When this report is written, the command logging program “command-frequency.el” used “this-command” variable to record what command is being called. The “this-command” lumps together backward-kill-word, kill-word, kill-line, kill-region, all into just kill-region. (see: (info "(elisp) Command Loop Info")) This problem is fixed in the current version of the “command-frequency.el”. (it now uses real-last-command variable to log commands)
Subsequent stat using Xah Lee's stat shows that, the lumped kill commands have this frequentcy distribution:
The above distribution is retrofitted into the report.
If you like to participate in this research, please download command-frequency.el and send me the output. I will incorporate your data into the next report update. Thank you.
Thanks to Ryan Yeske for the inital version of command-frequency.el. Thanks to Michal Nazarewicz writing it into a full featured minor mode. Thanks to David Capello for improving the code. Thanks to Katsumi Yamaoka for pointing out the problem of “this-command”. Thanks to Stefan Guath for pointing out “real-last-command”. Thanks to Marc Shapiro and Rick Bielawski for providing me their data.
Addendum: My own (Xah Lee) command usage stat for 5 months: command-frequency_xah.txt.