From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Strange behavior of C-u in the presence of sit-for in p-c-h Date: Tue, 17 Oct 2006 21:57:17 -0400 Message-ID: References: <87y7rfdmjg.fsf@furball.mit.edu> <87zmbuabq9.fsf@stupidchicken.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1161137073 17751 80.91.229.2 (18 Oct 2006 02:04:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 18 Oct 2006 02:04:33 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 18 04:04:30 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Ga0gt-0006MF-P5 for ged-emacs-devel@m.gmane.org; Wed, 18 Oct 2006 03:58:02 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ga0gt-0006nt-FE for ged-emacs-devel@m.gmane.org; Tue, 17 Oct 2006 21:57:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ga0gP-0006a6-Om for emacs-devel@gnu.org; Tue, 17 Oct 2006 21:57:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ga0gK-0006TC-Qi for emacs-devel@gnu.org; Tue, 17 Oct 2006 21:57:25 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ga0gK-0006Sh-Ee for emacs-devel@gnu.org; Tue, 17 Oct 2006 21:57:20 -0400 Original-Received: from [209.226.175.25] (helo=tomts5-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Ga0gJ-00019H-K2; Tue, 17 Oct 2006 21:57:19 -0400 Original-Received: from pastel.home ([70.55.81.188]) by tomts5-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20061018015717.TWBC18394.tomts5-srv.bellnexxia.net@pastel.home>; Tue, 17 Oct 2006 21:57:17 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 7B0D480C5; Tue, 17 Oct 2006 21:57:17 -0400 (EDT) Original-To: Chong Yidong In-Reply-To: <87zmbuabq9.fsf@stupidchicken.com> (Chong Yidong's message of "Tue\, 17 Oct 2006 17\:11\:58 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:60851 Archived-At: > 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? The check on line 3262 seems odd. If we trace it back it was introduced in revision 1.489 in the following form: if (this_command_key_count == 0 || ! reread) the log comment doesn't say much useful: (read_char): Call the input method if appropriate. Change logic for distinguishing rereads from new events; use local var `reread'. Take events from Vunread_input_method_events and Vunread_post_input_method_events. I'm not sure exactly what this was trying to avoid, but the test looks odd. Maybe the "!reread" could make some sense, but the "this_command_key_count==0" looks positively odd since it may end up recording the first (and only the first) of a sequence of keys. Maybe the problem is that `this-command-keys' has several potential uses and they are incompatible: in one case one wants this-command-keys to list the keys the user has typed (independently from whether or not some of those keys were later read&unread&reread&reunread&rereread), whereas in the other one wants the exact key-sequence which triggered this command, so we can push it back on unread-command-events to force re-interpretation of those keys. Stefan