devil mode
- date: 2026-04-09
- tags: emacs
- identifier: 20260409T161000
emacs' default keybindings can be hostile to the hand. for example, C-M-x is not uncommon, and requires you to hold Control and Meta (aka Alt) while pressing X. this hurts many people's wrists over time, not to mention slowing people down.
two common alternative binding schemes are `evil-mode`, emulating vi(m), and `god-mode`, the scheme of which effectively allows you to press modifiers in sequence rather than simultaneously.
my favorite scheme, and the one I use for the longest uninterrupted periods before foraying once more, is `devil-mode`.
devil mode homepage
devil mode homepage (internet archive)
overview
activating devil mode sacrifices your comma key to the devil in exchange for speed and wrist health.
- pressing comma applies Control to the next key
- pressing comma then M applies Meta to the next key
- pressing comma then M then M again applies both
then how do you type a comma?
- pressing comma twice inserts a comma
- pressing comma then space inserts a comma and a space
- pressing comma then return inserts a comma and a newline
then how do you run C-, or C-<space> or C-<return> or C-m or M-m?
- pressing comma then Z applies Control to the next key no matter what
- pressing comma then M then Z applies Meta to the next key no matter what
what why
- emacs can be controlled comfortably with one hand, which is nice while snacking, on the phone, or using a mouse
- keybindings are consistently used and remembered across devil and default modes of use
- precise timing is not required to reliably differentiate, say C-x b and C-x C-b
- no command is too awkward to use
- almost every major and minor mode plays well with devil out of the box. if it doesn't, avoiding comma except to press it twice tends to work (graceful degradation/progressive enhancement)
an idiosyncracy of mine
by default, devil can repeat some common commands. for example, to move down three lines, instead of
, n , n , n
you can type
, n n n
I don't like these repeats. it happens more often than I expected that, for example, I want to move down three lines, then insert the letter n. then
, n , n , n n
becomes
, n n n C-g n
where C-g can be replaced by any key other than n. but note: C-g will quit the minibuffer, where devil otherwise works without issue for, e.g., C-f and C-b.
therefore, I disable all repeats by setting the variable `devil-repeatable-keys` to nil. I have regained the convenience of repetition by explicit use of C-x z.
C-x z
C-x z, by default, is bound to the command `repeat`.
from its docstring:
If this command is invoked by a multi-character key sequence, it
can then be repeated by repeating the final character of that
sequence.
say I want to move down some 10 lines, but I have not precalculated the number 10. I will move by visual feedback. with default devil behavior, we could do
, n n n n n n n n n n
with repeat, it is
, n , x z z z z z z z z z
which I find tolerable in exchange for explicit repetition.
I recommend making a habit of the repeat command in general. it has reaped benefits across my emacs usage.
on modality
I'm going to spitball some history off the dome now. probably wrongness here.
the Ctrl-C, Ctrl-V, Ctrl-X editing scheme you may be used to were designed as part of CUA: the Common User Access guidelines. these emerged from an IBM lab when a programmer whose name many recall lamented people "getting stuck in modes". many of the editors of the day were like vi, which is like its grandparent ed: they are modal.
indeed, it's common for people learning modal editors for the first time to get "stuck in modes". many vim tutorials offer the same palliative: enter insert mode for the minimum time necessary. press i, type your text, and press escape.
I find this to be good advice: pick a "default" mode, and stay in it as often as possible. if it's hard to pick a default, perhaps there are too many modes.
to me, devil lives maximally into this ideal once repeatable keys are disabled. only CUA and default emacs are better, being modeless, and I like the ability of modes to amplify the power of the easiest keys on the keyboard. the trouble I described above, regarding repeatable keys, is exactly an example of getting "stuck in a mode": the algorithmically-determined function of the next keypress did not match the user's intention. CUA, default emacs, and vim tutorials therefore all have the right idea: make the default state one where the next intended action and the next actual action are aligned as often as possible.
we could measure the keystrokes for which a non-default mode lasts. CUA and default emacs have no non-default mode. in the vi family, it lasts as long as you are inserting text, which can be a long or short time. (it doesn't help that most pauses to stop and think occur in the middle of writing a sentence or line of code.) with devil mode, it lasts a few keystrokes, or while repeating, until I press something other than Z. EZ.