Skip to content

Replace read-event with read-key #34

@gerd-moellmann

Description

@gerd-moellmann

I found a problem whiletrying Devil on a TTY together with kkp.el, https://github.com/benotn/kkp.

kkp.el uses input-decode-map to map all sorts of escape sequences that a KKP-capable terminal emulator like iTerm2 produces to Emacs keys. This way, keys liek S-<left> or C-M-b become available on a TTY.

The problem is that devil--read-key uses read-event to read keys, and read-event does not obey input-decode-map. That means that Devil doesn't work with keys like <f4> or <left>,

The fix is easy though: Replace read-event with read-key, and it works: , <left> becomes C-<left> and so on.

  (defun devil--read-key (prompt key)
    (setq key (vconcat key (vector (read-key (devil-format prompt key)))))
    (or (devil--find-special-command key)
	(devil--find-regular-command key)

(See also https://lists.gnu.org/archive/html/bug-gnu-emacs/2025-01/msg02175.html, for some further background.)

Thanks for nice idea! Defiantly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions