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 1161368950 24864 80.91.229.2 (20 Oct 2006 18:29:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 20 Oct 2006 18:29:10 +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 20:29:04 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 1Gaz6v-0006bn-V8 for ged-emacs-devel@m.gmane.org; Fri, 20 Oct 2006 20:28:53 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Gaz6v-0002PY-Db for ged-emacs-devel@m.gmane.org; Fri, 20 Oct 2006 14:28:49 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GapUR-0006xJ-9R for emacs-devel@gnu.org; Fri, 20 Oct 2006 04:12:27 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GapUN-0006p0-UY for emacs-devel@gnu.org; Fri, 20 Oct 2006 04:12:26 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GapUN-0006ow-QA for emacs-devel@gnu.org; Fri, 20 Oct 2006 04:12:23 -0400 Original-Received: from [195.41.46.236] (helo=pfepb.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GapUL-0006gR-Dh; Fri, 20 Oct 2006 04:12:21 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (unknown [80.165.4.124]) by pfepb.post.tele.dk (Postfix) with SMTP id 26D46A50074; Fri, 20 Oct 2006 10:12:14 +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) Original-Lines: 88 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:60947 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