From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: bug#5923: 23.1.95; minibuffer-message discards input events Date: Tue, 20 Apr 2010 09:18:28 -0700 Message-ID: References: <6ED90800C89F408BB0C3F86660BB4C10@us.oracle.com><7C90907943E64115BA7CFABFB144BD24@us.oracle.com><497D764814894831A571BD283D21B9DA@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0066_01CAE06A.71A22F50" X-Trace: dough.gmane.org 1271781015 29599 80.91.229.12 (20 Apr 2010 16:30:15 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 20 Apr 2010 16:30:15 +0000 (UTC) Cc: 5923@debbugs.gnu.org To: "'Stefan Monnier'" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 20 18:30:13 2010 connect(): No such file or directory Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O4GKx-0005rr-Ab for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Apr 2010 18:30:12 +0200 Original-Received: from localhost ([127.0.0.1]:33560 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4GKt-0004dl-Ag for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Apr 2010 12:30:07 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O4GKL-0004QO-2A for bug-gnu-emacs@gnu.org; Tue, 20 Apr 2010 12:29:33 -0400 Original-Received: from [140.186.70.92] (port=47540 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4GKH-0004On-ME for bug-gnu-emacs@gnu.org; Tue, 20 Apr 2010 12:29:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O4GKE-000560-4m for bug-gnu-emacs@gnu.org; Tue, 20 Apr 2010 12:29:27 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59403) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O4GKD-00055w-W6 for bug-gnu-emacs@gnu.org; Tue, 20 Apr 2010 12:29:26 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1O4GAA-0008EL-0d; Tue, 20 Apr 2010 12:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Apr 2010 16:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 5923 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 5923-submit@debbugs.gnu.org id=B5923.127178032531626 (code B ref 5923); Tue, 20 Apr 2010 16:19:01 +0000 Original-Received: (at 5923) by debbugs.gnu.org; 20 Apr 2010 16:18:45 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O4G9s-0008E3-Bv for submit@debbugs.gnu.org; Tue, 20 Apr 2010 12:18:44 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O4G9q-0008Dy-Uk for 5923@debbugs.gnu.org; Tue, 20 Apr 2010 12:18:43 -0400 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o3KGIX1v032575 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 20 Apr 2010 16:18:35 GMT Original-Received: from acsmt354.oracle.com (acsmt354.oracle.com [141.146.40.154]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o3KApG3j027526; Tue, 20 Apr 2010 16:18:32 GMT Original-Received: from abhmt020.oracle.com by acsmt355.oracle.com with ESMTP id 174726751271780310; Tue, 20 Apr 2010 09:18:30 -0700 Original-Received: from dradamslap1 (/141.144.112.155) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Apr 2010 09:18:29 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: AcrbeN6P7ekC4+9VQH619MkvIjLwtAAFxw3wAPw1QPAAAXc+EABGGmQw X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Auth-Type: Internal IP X-Source-IP: acsinet15.oracle.com [141.146.126.227] X-CT-RefId: str=0001.0A090203.4BCDD3DC.0235:SCFMA922111,ss=1,fgs=0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 20 Apr 2010 12:19:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:36371 Archived-At: This is a multi-part message in MIME format. ------=_NextPart_000_0066_01CAE06A.71A22F50 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit The problem appears to be with `sit-for', not with `minibuffer-message'. More specifically, the call to `input-pending-p' in `sit-for' does not act as it should. Dunno if `input-pending-p' is the problem generally, or just in this context. Attached is a small, simple, self-contained file that reproduces the problem. Just load it, then `M-x C-u sssss'. The `s' keystrokes are ignored while the `sit-for' delay is waited for. In all cases except `icicle-universal-argument', the original command is called, followed by a call to `message' and then `sit-for'. `icicle-universal-argument' is identical to `universal-argument' except: * It too calls `message' followed by `sit-for'. * It uses `icicle-ensure-overriding-map-is-bound', not `ensure-overriding-map-is-bound'. The difference is that the former sets `overriding-terminal-local-map' to `icicle-universal-argument-map', not `universal-argument-map'. The difference between those two maps is that the `icicle-*' commands are used in place of the originals (and each `icicle-*' command calls `message' followed by `sit-for'). So all of the changes from the vanilla Emacs code amount to the same trivial change: Add a call to `message' and `sit-for' after the vanilla command behavior is finished. There are no other changes. `sit-for' seems to be the problem, but there is no change in the code for `sit-for' from Emacs 22 and Emacs 23 (where the bug first appears). Perhaps there is a relevant change elsewhere that has to do with these keymaps or with input events? Debugging `sit-for' a bit indicates that `input-pending-p' does indeed return nil when it should return non-nil in this context (after user input). The final `cond' branch is taken in the `sit-for' code, instead of the `input-pending-p' branch. There is no change in the C source code for `input-pending-p' itself, between Emacs 22 and 23. But it tests several global vars in order to do its thing, so perhaps the bug was introduced by changing the value of one of those vars. The vars are `unread-command-events', `unread-command-char', `unread-post-input-method-events', and `unread-input-method-events'. That seems likely. Note this in the doc string of `input-pending-p': "Actually, the value is nil only if we can be ***sure*** that no input is available; if there is a doubt, the value is t." Obviously, we are by no means respecting that declared conservative behavior. It is returning nil (in this case) even when we should not be sure that no input is available - even when input is in fact available. I hope this bug will be fixed. Thx. ------=_NextPart_000_0066_01CAE06A.71A22F50 Content-Type: application/octet-stream; name="bug-5923-emacs-4.el" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="bug-5923-emacs-4.el" (defvar icicle-universal-argument-map=0A= (let ((map (make-sparse-keymap)))=0A= (define-key map [t] 'icicle-universal-argument-other-key)=0A= (define-key map (vector meta-prefix-char t) = 'icicle-universal-argument-other-key)=0A= (define-key map [switch-frame] nil)=0A= (define-key map [?\C-u] 'icicle-universal-argument-more)=0A= (define-key map [?-] 'icicle-universal-argument-minus)=0A= (define-key map [?0] 'icicle-digit-argument)=0A= (define-key map [?1] 'icicle-digit-argument)=0A= (define-key map [?2] 'icicle-digit-argument)=0A= (define-key map [?3] 'icicle-digit-argument)=0A= (define-key map [?4] 'icicle-digit-argument)=0A= (define-key map [?5] 'icicle-digit-argument)=0A= (define-key map [?6] 'icicle-digit-argument)=0A= (define-key map [?7] 'icicle-digit-argument)=0A= (define-key map [?8] 'icicle-digit-argument)=0A= (define-key map [?9] 'icicle-digit-argument)=0A= (define-key map [kp-0] 'icicle-digit-argument)=0A= (define-key map [kp-1] 'icicle-digit-argument)=0A= (define-key map [kp-2] 'icicle-digit-argument)=0A= (define-key map [kp-3] 'icicle-digit-argument)=0A= (define-key map [kp-4] 'icicle-digit-argument)=0A= (define-key map [kp-5] 'icicle-digit-argument)=0A= (define-key map [kp-6] 'icicle-digit-argument)=0A= (define-key map [kp-7] 'icicle-digit-argument)=0A= (define-key map [kp-8] 'icicle-digit-argument)=0A= (define-key map [kp-9] 'icicle-digit-argument)=0A= (define-key map [kp-subtract] 'icicle-universal-argument-minus)=0A= map)=0A= "...")=0A= =0A= (defun icicle-universal-argument ()=0A= (interactive)=0A= (setq prefix-arg (list 4)=0A= universal-argument-num-events (length (this-command-keys)))=0A= (icicle-ensure-overriding-map-is-bound)=0A= (icicle-msg-maybe-in-minibuffer "prefix %S" prefix-arg))=0A= =0A= (defun icicle-digit-argument (arg)=0A= (interactive "P")=0A= (digit-argument)=0A= (icicle-msg-maybe-in-minibuffer "prefix %S" prefix-arg))=0A= =0A= (defun icicle-negative-argument (arg)=0A= (interactive "P")=0A= (negative-argument arg)=0A= (icicle-msg-maybe-in-minibuffer "prefix %S" prefix-arg))=0A= =0A= (defun icicle-universal-argument-more (arg)=0A= (interactive "P")=0A= (universal-argument-more arg)=0A= (icicle-msg-maybe-in-minibuffer "prefix %S" prefix-arg))=0A= =0A= (defun icicle-universal-argument-other-key (arg)=0A= (interactive "P")=0A= (universal-argument-other-key arg)=0A= (icicle-msg-maybe-in-minibuffer "prefix %S" prefix-arg))=0A= =0A= (defun icicle-universal-argument-minus (arg)=0A= (interactive "P")=0A= (universal-argument-minus arg)=0A= (icicle-msg-maybe-in-minibuffer "prefix %S" prefix-arg))=0A= =0A= (defun icicle-ensure-overriding-map-is-bound ()=0A= (unless overriding-map-is-bound=0A= (setq saved-overriding-map overriding-terminal-local-map=0A= overriding-terminal-local-map icicle-universal-argument-map=0A= overriding-map-is-bound t)))=0A= =0A= (defun icicle-msg-maybe-in-minibuffer (format-string &rest args)=0A= (apply #'message format-string args)=0A= (sit-for 1))=0A= =0A= (define-key minibuffer-local-completion-map [remap universal-argument]=0A= 'icicle-universal-argument)=0A= (define-key minibuffer-local-completion-map [remap negative-argument]=0A= 'icicle-negative-argument)=0A= (define-key minibuffer-local-completion-map [remap digit-argument]=0A= 'icicle-digit-argument)=0A= =0A= ------=_NextPart_000_0066_01CAE06A.71A22F50--