[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18355: unicode and multi-byte key-event support for function recent-

From: Stefan Monnier
Subject: bug#18355: unicode and multi-byte key-event support for function recent-keys
Date: Fri, 29 Aug 2014 14:39:45 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

tags 18355 notabug

> DISCUSSION: Function `recent-keys' returns a 300-byte vector of most
> recent keyboard events, and describes this as the 300 most recent
> keypresses. However, between the advent of unicode variable-byte locales
> and modern keyboards, those 300 bytes represent an unknown number of
> keyboard events, that become very difficult to parse. There is no
> guarantee that the bottom of the FIFO corresponds to the first byte of a
> keyboard event, and there isn't clarity how many bytes at the top
> of the FIFO are the first event, since it is the FINAL byte of the most
> recent event that is on the top of the FIFO..

The problem you're encountering is because you run Emacs in a tty.
Under a GUI the events you see are more closely mapped to "keyboard
events".  But under a tty, Emacs does not get told which sequences of
bytes are "one event".  It does manage to figure it out thanks to the
input-decode-map and several of its friends, tho this is a rather tricky
and unreliable business.  E.g. try (under a typical tty) to hit ESC
ESC Home.

The recent-keys gives you the "low-level" view of what Emacs received
from the OS.  If it looks like a mess that's hard to parse, it's because
it *is* a mess that's hard to parse.

If code relies on recent-keys and parses that, I'd just say that this
code gets what it asked for: recent-keys is meant for debugging, not for
normal use.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]