Skip to content

donkey 1.14.0 — NORMAL state answers every printable key

Choose a tag to compare

@YardQuit YardQuit released this 15 Sep 12:28
· 169 commits to master since this release
c950667

This one came out of a question with no bug attached: in NORMAL state,
can you be sure what a key does? The answer was no, and the reason was
structural rather than a mistake. Suppression worked by remapping the
typing commands by name, and a name cannot reach a command that has
none — so thirty-two printable keys fell through to the major mode,
and what they did there depended on which buffer you were in.

The case that made it concrete: idlwave-mode binds & to an
anonymous command that inserts an ampersand. No list of names could
ever have caught it, however long the list grew.

Changed — you will notice these

  • A key a major mode bound that DONKEY does not now does nothing
    in NORMAL state, and says is undefined when you press it. This is
    answered from under the keymap rather than from a list, so it holds
    for every printable key, in every mode, including modes nobody has
    installed.
  • To hand a key back to the buffer, unbind it — exactly as before,
    (keymap-unset donkey-normal-mode-map ";"). That now works for any
    printable key rather than only the ones DONKEY had bound.
  • M-x donkey-debug-platform says which kind of buffer the report
    came from — Insert [S], Insert [E] or Insert [I] — and, where
    something decided it, what decided it. In a Dired buffer it used to
    say State here: Insert, which is true and tells a bug report
    nothing.

Under the hood

  • The modeline asks which kind of buffer this is once and remembers
    the answer, where it worked it out on every redisplay. Byte-compiled
    in a Dired buffer the lighter goes from 1.50 µs to 0.38, and in a
    graphical frame from 1.47 to 0.23. The letter and the cursor shape
    come from that one answer now, so the two cannot disagree.
  • The test suite's docstrings are held to the package's own spelling
    rules by a guard that renders them — a hundred and one lines were
    wrong in a way that showed only in the rendered text, and nothing
    had ever rendered them.

Upgrading

Nothing to do, unless you had come to rely on a major mode's key
reaching through NORMAL state in a buffer you write in. If you had,
name it and unbind it:

(with-eval-after-load 'donkey
  (keymap-unset donkey-normal-mode-map "&"))   ; & is the mode's again

Your own bindings are untouched, including a prefix hung on a key
DONKEY does not bind — (keymap-set donkey-normal-mode-map "s d" ...)
works as it always did.