From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: Strange behavior of C-u in the presence of sit-for in p-c-h Date: Thu, 19 Oct 2006 23:09:28 +0200 Message-ID: References: <87y7rfdmjg.fsf@furball.mit.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1161360266 20908 80.91.229.2 (20 Oct 2006 16:04:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 20 Oct 2006 16:04:26 +0000 (UTC) Cc: emacs-devel@gnu.org, rms@gnu.org, Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 20 18:04:21 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 1Gawqv-0000PW-Db for ged-emacs-devel@m.gmane.org; Fri, 20 Oct 2006 18:04:09 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gawqu-0001YA-PJ for ged-emacs-devel@m.gmane.org; Fri, 20 Oct 2006 12:04:08 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Gaf9h-000383-SV for emacs-devel@gnu.org; Thu, 19 Oct 2006 17:10:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Gaf9g-00035Q-AB for emacs-devel@gnu.org; Thu, 19 Oct 2006 17:10:20 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gaf9g-000356-0w for emacs-devel@gnu.org; Thu, 19 Oct 2006 17:10:20 -0400 Original-Received: from [195.41.46.235] (helo=pfepa.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1Gaf9d-000391-HV; Thu, 19 Oct 2006 17:10:17 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (0x503e2644.bynxx3.adsl-dhcp.tele.dk [80.62.38.68]) by pfepa.post.tele.dk (Postfix) with SMTP id 4EDA4FAC039; Thu, 19 Oct 2006 23:10:08 +0200 (CEST) Original-To: Chong Yidong In-Reply-To: <87y7rfdmjg.fsf@furball.mit.edu> (Chong Yidong's message of "Tue\, 17 Oct 2006 10\:50\:11 -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:60931 Archived-At: Chong Yidong 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. Here is a simple patch which fixes the problem AFAICS. It uses a special event code (t . EVENT) in unread-command-events to specify that EVENT is _not_ reread. Of course, this should be documented in unread-command-events if people think this fix is ok. *** keyboard.c 10 Oct 2006 10:33:25 +0200 1.878 --- keyboard.c 19 Oct 2006 23:00:23 +0200 *************** *** 2537,2542 **** --- 2537,2554 ---- c = XCAR (Vunread_command_events); Vunread_command_events = XCDR (Vunread_command_events); + reread = 1; + + /* Undo what sit-for did when it unread additional keys + inside universal-argument. */ + + if (CONSP (c) + && EQ (XCAR (c), Qt)) + { + reread = 0; + c = XCDR (c); + } + /* Undo what read_char_x_menu_prompt did when it unread additional keys returned by Fx_popup_menu. */ if (CONSP (c) *************** *** 2550,2556 **** && (EQ (c, Qtool_bar) || EQ (c, Qmenu_bar))) *used_mouse_menu = 1; - reread = 1; goto reread_for_input_method; } --- 2562,2567 ---- Index: subr.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/subr.el,v retrieving revision 1.530 diff -c -r1.530 subr.el *** subr.el 18 Oct 2006 10:56:46 -0000 1.530 --- subr.el 19 Oct 2006 21:08:24 -0000 *************** *** 1752,1759 **** (or nodisp (redisplay)) (let ((read (read-event nil nil seconds))) (or (null read) ! (progn (push read unread-command-events) ! nil)))))) ;;; Atomic change groups. --- 1758,1768 ---- (or nodisp (redisplay)) (let ((read (read-event nil nil seconds))) (or (null read) ! (progn ! (if (eq overriding-terminal-local-map universal-argument-map) ! (setq read (cons t read))) ! (push read unread-command-events) ! nil)))))) ;;; Atomic change groups. -- Kim F. Storm http://www.cua.dk