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. (e.g. pressing
“a” actually calls the command
self-insert-command
.
Pressing Ctrl+f
calls the command
forward-char
. Pressing Alt+x calls
execute-extended-command
.
Pressing the → calls forward-char
.)
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.
Preliminary
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%
Command | Count | Percentage |
---|---|---|
self-insert-command | 65496 | 32.25 |
↓ | 23960 | 11.80 |
↑ | 18917 | 9.31 |
→w | 11224 | 5.53 |
←w | 6782 | 3.34 |
→ | 6650 | 3.27 |
⌫ | 6558 | 3.23 |
← | 4393 | 2.16 |
nonincremental-repeat-search-forward | 4141 | 2.04 |
back-to-indentation-or-beginning | 3273 | 1.61 |
isearch-printing-char | 2682 | 1.32 |
end-of-code-or-line | 2479 | 1.22 |
cua-delete-region | 2309 | 1.14 |
⌫w | 2041 | 1.00 |
▼ | 1896 | 0.93 |
yank | 1691 | 0.83 |
▲ | 1483 | 0.73 |
indent-relative | 1333 | 0.66 |
save-buffer | 1302 | 0.64 |
just-one-space | 1295 | 0.64 |
newline | 1185 | 0.58 |
handle-switch-frame | 1117 | 0.55 |
(lambda nil (interactive) (scroll-up 1)) | 1095 | 0.54 |
⌦l | 1001 | 0.49 |
⌦ | 996 | 0.49 |
rgb-doublespace-maybe | 972 | 0.48 |
search-backward | 932 | 0.46 |
execute-extended-command | 900 | 0.44 |
universal-argument-other-key | 891 | 0.44 |
cua-copy-region | 802 | 0.39 |
mouse-drag-region | 746 | 0.37 |
kill-buffer-silently | 740 | 0.36 |
digit-argument | 731 | 0.36 |
nonincremental-search-forward | 721 | 0.35 |
isearch-→ | 694 | 0.34 |
cua-resize-rectangle-right | 674 | 0.33 |
other-window | 672 | 0.33 |
cua-resize-rectangle-down | 636 | 0.31 |
undo | 624 | 0.31 |
⌦w | 601 | 0.30 |
|◀ | 546 | 0.27 |
mouse-set-point | 531 | 0.26 |
jump-to-register | 488 | 0.24 |
point-to-register | 481 | 0.24 |
(lambda nil (interactive) (scroll-down 1)) | 410 | 0.20 |
facemenu-set-bold | 401 | 0.20 |
nonincremental-repeat-search-backward | 397 | 0.20 |
minibuffer-complete | 370 | 0.18 |
|← | 359 | 0.18 |
set-mark-command | 351 | 0.17 |
→| | 348 | 0.17 |
insert-prior-line-char | 338 | 0.17 |
▶| | 336 | 0.17 |
isearch-other-control-char | 324 | 0.16 |
dired | 320 | 0.16 |
newline-and-indent | 316 | 0.16 |
dired-advertised-find-file | 308 | 0.15 |
isearch-other-meta-char | 295 | 0.15 |
next-file-buffer | 287 | 0.14 |
find-file | 265 | 0.13 |
kill-buffer | 233 | 0.11 |
cua-move-rectangle-right | 228 | 0.11 |
fill-paragraph | 225 | 0.11 |
isearch-← | 221 | 0.11 |
(lambda nil (interactive) (mark-sexp -1 t)) | 218 | 0.11 |
✂ | 195 | 0.10 |
revert-buffer | 188 | 0.09 |
universal-argument | 182 | 0.09 |
exit-minibuffer | 176 | 0.09 |
copy | 174 | 0.09 |
cua-resize-rectangle-up | 174 | 0.09 |
search-word-under-cursor | 165 | 0.08 |
recenter | 164 | 0.08 |
cua-insert-char-rectangle | 162 | 0.08 |
ediff-next-difference | 152 | 0.07 |
scroll-bar-toolkit-scroll | 148 | 0.07 |
kill-this-buffer | 147 | 0.07 |
delete-other-windows | 145 | 0.07 |
extend-selection | 144 | 0.07 |
eval-last-sexp | 141 | 0.07 |
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: Command Loop Info (ELISP Manual) ) 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:
backward-kill-word | .53 |
kill-line | .26 |
kill-word | .16 |
kill-region | .05 |
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.
2009-01-23 Addendum: My own (Xah Lee) command usage stat for 5 months: command-frequency_xah.txt.