* Suspected bug in reset-this-command-events
@ 2003-01-31 22:55 Alan Mackenzie
0 siblings, 0 replies; only message in thread
From: Alan Mackenzie @ 2003-01-31 22:55 UTC (permalink / raw)
Emacs 21.1, Linux tty.
In what? reset-this-command-events is a thing that helps deal with the
actual command key after entering a prefix argument with C-u, or
whatever.
I type C-u <right>, slowly enough so that it echoes in the echo area.
What actually echoes in the echo area is:
C-u ESC [ right
What _ought_ to echo in the echo area is surely:
C-u right
A quick glance at the lossage buffer (C-h l) confirms that my keyboard
setup is correctly generating the expected escape sequence "ESC [ C" when
I type the <right> key.
Now after typing C-u, ANY subsequent key is bound in
universal-argument-map which is the highest priority keymap. (see
simple.el, line 1527 or thereabouts). This keymap's binding for
<esc>anything is:
(defun universal-argument-other-key (arg)
(interactive "P")
(setq prefix-arg arg)
(let* ((key (this-command-keys))
(keylist (listify-key-sequence key)))
(setq unread-command-events
(append (nthcdr universal-argument-num-events keylist)
unread-command-events)))
(reset-this-command-lengths)
(setq overriding-terminal-local-map nil))
After having typed C-u <right>, my understanding is that:
1: ARG will here be (4) [as a result of typing C-u].
2: (this-command-keys) will return "C-u <esc> ["
3: KEYLIST will become (?\C-u ?\e ?\[)
4: UNIVERSAL-ARGUMENT-NUM-EVENTS will be 1 (since C-u is a single event).
5: UNREAD-COMMAND-EVENTS will become (?\e ?\[)
What, then, does (reset-this-command-lengths) do? I don't fully
understand its doc-string, but its meat states:
> Calling this function directs the translated event to replace the
> original event, so that only one version of the event actually appears
> in the echo area and in the value of `this-command-keys.'.
It seems to me that its reference to "THE" original event is a bit awry.
"The original event" is actually a three event sequence, (<esc> [ C), and
it seems as though only the last of the events is getting replaced by the
symbol 'right in THIS-COMMAND-KEYS. If this is the case, then any
command which uses THIS-COMMAND-KEYS in such circumstances is liable to
get fouled up. I am trying to use just such a command.
Many thanks in advance for any help.
--
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-01-31 22:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-31 22:55 Suspected bug in reset-this-command-events Alan Mackenzie
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).