[Top][All Lists]

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

Suspected bug in reset-this-command-events

From: Alan Mackenzie
Subject: Suspected bug in reset-this-command-events
Date: 31 Jan 2003 23:55:28 +0100
Date: Fri, 31 Jan 2003 21:21:07 +0000
User-agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686))

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

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)
  (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: address@hidden; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").

reply via email to

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