all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: Strange behavior of C-u in the presence of sit-for in p-c-h
Date: Tue, 17 Oct 2006 17:11:58 -0400	[thread overview]
Message-ID: <87zmbuabq9.fsf@stupidchicken.com> (raw)
In-Reply-To: <87y7rfdmjg.fsf@furball.mit.edu> (Chong Yidong's message of "Tue\, 17 Oct 2006 10\:50\:11 -0400")

Chong Yidong <cyd@stupidchicken.com> writes:

> Here is an easy way to reproduce the underlying bug:
>
> (defun foo ()
>   (interactive)
>   (universal-argument)
>   (push ?a unread-command-events))
>
> M-x foo RET
>
> The expected result is aaaa, but in fact nothing is printed.

The problem here is that C-u works through the command
`universal-argument-other-key', which sets prefix-arg and then adds
(this-command-keys) to unread-command-events so that it is executed
with that prefix argument.

This normally works ok.  However, suppose the call to
read_key_sequence in the command loop takes its input from
unread-command-events.  (This happens if the input came during a
sit-for in post-command-hook, as in Stefan's original example, or
directly as in the example above.)  This kind of "reread input" is
explicitly *not* added to this_command_keys.  The rationale for this
is not clear to me, but there may be a good reason since the code
explicitly checks for this; see keyboard.c:789.  Then
`universal-argument-other-key' can't see that input.

OTOH, I don't see a safe way of fixing this.  Any suggestions?

  reply	other threads:[~2006-10-17 21:11 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-14 16:44 Strange behavior of C-u in the presence of sit-for in p-c-h Stefan Monnier
2006-10-16 13:50 ` Richard Stallman
2006-10-16 16:04   ` Stefan Monnier
2006-10-17  6:54     ` Richard Stallman
2006-10-17 14:50       ` Chong Yidong
2006-10-17 21:11         ` Chong Yidong [this message]
2006-10-17 22:12           ` Stefan Monnier
2006-10-17 22:18             ` Chong Yidong
2006-10-18  1:57           ` Stefan Monnier
2006-10-18  2:19             ` Chong Yidong
2006-10-18  5:57               ` Stefan Monnier
2006-10-18 14:28                 ` Chong Yidong
2006-10-18 15:23                   ` Stefan Monnier
2006-10-19  6:41                     ` Richard Stallman
2006-10-19  6:41                   ` Richard Stallman
2006-10-19 14:31                     ` Chong Yidong
2006-10-19 14:51                   ` Johan Bockgård
2006-10-18 17:54             ` Richard Stallman
2006-10-18 23:57               ` Chong Yidong
2006-10-19  9:01                 ` Kim F. Storm
2006-10-19 21:09         ` Kim F. Storm
2006-10-21  2:03           ` Richard Stallman
2006-10-22 22:54             ` Kim F. Storm
2006-10-19 21:09         ` Kim F. Storm
2006-10-19 21:25           ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zmbuabq9.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.