GNU bug report logs - #3938
23.0.96; regression: minibuffer-message interferes with C-u

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Sun, 26 Jul 2009 23:35:05 UTC

Severity: normal

Tags: fixed

Merged with 5923

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 3938 in the body.
You can then email your comments to 3938 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3938; Package emacs. (Sun, 26 Jul 2009 23:35:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 26 Jul 2009 23:35:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <emacs-pretest-bug <at> gnu.org>
Subject: 23.0.96; regression: minibuffer-message interferes with C-u
Date: Sun, 26 Jul 2009 16:30:44 -0700
emacs -Q
 
Eval these:

(defun test-univ-arg ()
  (interactive)
  (setq prefix-arg                     (list 4)
        universal-argument-num-events  (length (this-command-keys)))
  (minibuffer-message "FOO") ; NO GOOD. OK ONLY IF THIS IS REMOVED
  (ensure-overriding-map-is-bound))
 
(defun test2 () (interactive) (describe-function '+))
 
(define-key minibuffer-local-completion-map "\C-f" 'test2)
(define-key minibuffer-local-completion-map
  (vector 'remap 'universal-argument) 'test-univ-arg)
 
Note that the definition of `test-univ-arg' is identical to the
definition of `universal-argument', except for the addition of the
call to `minibuffer-message'.


1. Now do this, without waiting for the 2-sec delay after C-u.
That is, hit C-f immediately after C-u.
 
M-x C-u C-f
 
2. Now do `M-x C-u C-f' again, this time waiting for the delay,
so the minibuffer message `FOO' is no longer displayed, before
hitting `C-f'.
 
#2 has the correct behavior: the input event `C-f' interrupts the
minibuffer message and immediately executes the `C-f' command (the
particular command used is immaterial; I use `describe-function'
just to easily see whether it is executed).
 
In Emacs 23, #1 has this incorrect effect: After C-u, the minibuffer
message FOO is erased, but the `C-f' is not picked up. You must
repeat `C-f' a second time, to get it to be picked up.

Note that if you hit C-f twice even very quickly, then the second
`C-f' is picked up (but not the first). IOW, the problem doesn't
seem to be that the delay has not passed. It seems to be that
only the first input event is ignored if the delay has not
expired. It's hard to hit C-f twice quickly, so I'm not certain
about this, but it seems to be the case.

In Emacs prior to Emacs 23, #1 also had the correct behavior of #2.
IOW, this is a regression.


In GNU Emacs 23.0.96.1 (i386-mingw-nt5.1.2600)
 of 2009-07-09 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'
 




Reply sent to Chong Yidong <cyd <at> stupidchicken.com>:
You have taken responsibility. (Tue, 28 Jul 2009 15:55:05 GMT) Full text and rfc822 format available.

Notification sent to "Drew Adams" <drew.adams <at> oracle.com>:
bug acknowledged by developer. (Tue, 28 Jul 2009 15:55:05 GMT) Full text and rfc822 format available.

Message #10 received at 3938-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 3938-done <at> debbugs.gnu.org
Subject: Re: 23.0.96; regression: minibuffer-message interferes with C-u
Date: Tue, 28 Jul 2009 11:46:30 -0400
> (defun test-univ-arg ()
>   (interactive)
>   (setq prefix-arg                     (list 4)
>         universal-argument-num-events  (length (this-command-keys)))
>   (minibuffer-message "FOO") ; NO GOOD. OK ONLY IF THIS IS REMOVED
>   (ensure-overriding-map-is-bound))
>
> (defun test2 () (interactive) (describe-function '+))
>
> (define-key minibuffer-local-completion-map "\C-f" 'test2)
> (define-key minibuffer-local-completion-map
>   (vector 'remap 'universal-argument) 'test-univ-arg)
>
> 1. Now do this, without waiting for the 2-sec delay after C-u.
> That is, hit C-f immediately after C-u.
>
> M-x C-u C-f

The function `sit-for', which `minibuffer-message' uses, treats C-u
specially.  It's easy to get your code to work; just put the call to
`minibuffer-message' after `ensure-overriding-map-is-bound':

(defun test-univ-arg ()
  (interactive)
  (setq prefix-arg                     (list 4)
        universal-argument-num-events  (length (this-command-keys)))
  (ensure-overriding-map-is-bound)
  (minibuffer-message "FOO"))



bug reopened, originator not changed. Request was from "Drew Adams" <drew.adams <at> oracle.com> to control <at> emacsbugs.donarmstrong.com. (Tue, 28 Jul 2009 20:20:04 GMT) Full text and rfc822 format available.

Reply sent to "Drew Adams" <drew.adams <at> oracle.com>:
You have taken responsibility. (Tue, 28 Jul 2009 20:20:06 GMT) Full text and rfc822 format available.

Notification sent to "Drew Adams" <drew.adams <at> oracle.com>:
bug acknowledged by developer. (Tue, 28 Jul 2009 20:20:06 GMT) Full text and rfc822 format available.

Message #17 received at 3938-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Chong Yidong'" <cyd <at> stupidchicken.com>
Cc: <3938-done <at> debbugs.gnu.org>
Subject: bug#3938: 23.0.96; regression: minibuffer-message interferes with C-u
Date: Tue, 28 Jul 2009 13:14:19 -0700
> The function `sit-for', which `minibuffer-message' uses, treats C-u
> specially.  It's easy to get your code to work; just put the call to
> `minibuffer-message' after `ensure-overriding-map-is-bound':
> 
> (defun test-univ-arg ()
>   (interactive)
>   (setq prefix-arg                     (list 4)
>         universal-argument-num-events  (length (this-command-keys)))
>   (ensure-overriding-map-is-bound)
>   (minibuffer-message "FOO"))

Actually, I already had the call to `minibuffer-message' last, in my own code.

I pared down my original code again, and discovered that the problem of the
regression is elsewhere. (Note, BTW, that the definition of `sit-for' has not
changed in Emacs 23 wrt Emacs 22, and this bug is a regression from Emacs 22.)

emacs -Q

(define-key minibuffer-local-must-match-map "\C-f" 'test2)
(define-key minibuffer-local-must-match-map
  (vector 'remap 'universal-argument) 'test-univ-arg)

(defun test2 () (interactive) (describe-function '+))

(defun test-univ-arg ()
  (interactive)
  (setq prefix-arg                     (list 4)
        universal-argument-num-events  (length (this-command-keys)))
  (my-ensure-overriding-map-is-bound)
  (minibuffer-message "FOO"))

;; Same as `ensure-overriding-map-is-bound', but with
;; `my-universal-argument-map' instead of `universal-argument-map'.
(defun my-ensure-overriding-map-is-bound ()
  (unless overriding-map-is-bound
    (setq saved-overriding-map           overriding-terminal-local-map
          overriding-terminal-local-map  my-universal-argument-map
          overriding-map-is-bound        t)))

;; Exact copy of `universal-argument-map'.
(defvar my-universal-argument-map
  (let ((map  (make-sparse-keymap)))
    (define-key map [t] 'universal-argument-other-key)
    (define-key map (vector meta-prefix-char t) 'universal-argument-other-key)
    (define-key map [switch-frame] nil)
    (define-key map [?\C-u] 'universal-argument-more)
    (define-key map [?-] 'universal-argument-minus)
    (define-key map [?0] 'digit-argument)
    (define-key map [?1] 'digit-argument)
    (define-key map [?2] 'digit-argument)
    (define-key map [?3] 'digit-argument)
    (define-key map [?4] 'digit-argument)
    (define-key map [?5] 'digit-argument)
    (define-key map [?6] 'digit-argument)
    (define-key map [?7] 'digit-argument)
    (define-key map [?8] 'digit-argument)
    (define-key map [?9] 'digit-argument)
    (define-key map [kp-0] 'digit-argument)
    (define-key map [kp-1] 'digit-argument)
    (define-key map [kp-2] 'digit-argument)
    (define-key map [kp-3] 'digit-argument)
    (define-key map [kp-4] 'digit-argument)
    (define-key map [kp-5] 'digit-argument)
    (define-key map [kp-6] 'digit-argument)
    (define-key map [kp-7] 'digit-argument)
    (define-key map [kp-8] 'digit-argument)
    (define-key map [kp-9] 'digit-argument)
    (define-key map [kp-subtract] 'universal-argument-minus)
    map))

IOW, we use an exact copy of `universal-argument-map' instead of
`universal-argument-map' itself. That's the only change from vanilla Emacs (the
definition of `my-ensure-overriding-map-is-bound' just reflects the vanilla
definition).

Same instructions as before: M-x C-u C-f, hitting C-f right after C-u (no delay)
vs waiting until the 2-sec delay for `minibuffer-message' has elapsed.

Compare the same test using Emacs 22.

With Emacs 23, the delay must elapse entirely - the user input event of hitting
`C-f' does not seem to interrupt it (`sit-for' should be interrupted by an input
event). So the effect, in Emacs 23, is that you need to hit `C-f' twice (or wait
before hitting it). In Emacs 22, hitting `C-f' just once works immediately. In
Emacs 23, the first `C-f' just has the effect of clearing "FOO" from the
minibuffer.


[Also, if instead of using `my-universal-argument-map' you use (copy-keymap
universal-argument-map) the result is the same. Using
`my-universal-argument-map' is a better test, since `copy-keymap' doesn't copy
recursively.]




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3938; Package emacs. (Tue, 28 Jul 2009 20:55:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Tue, 28 Jul 2009 20:55:06 GMT) Full text and rfc822 format available.

Message #22 received at 3938 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <3938 <at> debbugs.gnu.org>
Subject: bug#3938 BUG system seems messed up - I did not close this bug
Date: Tue, 28 Jul 2009 13:47:26 -0700
There is a problem with the bug system, it seems. I sent a simple reply to
Yidong's message, which had the original bug subject:
bug#3938: 23.0.96; regression: minibuffer-message interferes with C-u

However, somehow my reply got interpreted as CLOSING the bug. Yidong had closed
it. In fact, I had sent a control message to reopen it.

This bug system is a mess, it seems.

This bug should not be closed.

> -----Original Message-----
> From: Emacs bug Tracking System 
> [mailto:help-debbugs <at> gnu.org] 
> Sent: Tuesday, July 28, 2009 1:20 PM
> To: Drew Adams
> Subject: bug#3938 closed by "Drew Adams" 
> <drew.adams <at> oracle.com> (bug#3938: 23.0.96; regression: 
> minibuffer-message interferes with C-u)
> 
> 
> This is an automatic notification regarding your bug report
> which was filed against the emacs package:
> 
> #3938: 23.0.96; regression: minibuffer-message interferes with C-u
> 
> It has been closed by "Drew Adams" <drew.adams <at> oracle.com>.
> 
> Their explanation is attached below along with your original report.
> If this explanation is unsatisfactory and you have not received a
> better one in a separate message then please contact "Drew 
> Adams" <drew.adams <at> oracle.com> by
> replying to this email.
> 
> 
> -- 
> 3938: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3938
> Emacs Bug Tracking System
> Contact help-debbugs <at> gnu.org with problems
> 




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3938; Package emacs. (Tue, 28 Jul 2009 21:15:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sven Joachim <svenjoac <at> gmx.de>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Tue, 28 Jul 2009 21:15:05 GMT) Full text and rfc822 format available.

Message #27 received at 3938 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Sven Joachim <svenjoac <at> gmx.de>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 3938 <at> debbugs.gnu.org, Chong Yidong <cyd <at> stupidchicken.com>
Subject: Re: bug#3938: BUG system seems messed up - I did not close this bug
Date: Tue, 28 Jul 2009 23:11:00 +0200
On 2009-07-28 22:47 +0200, Drew Adams wrote:

> There is a problem with the bug system, it seems. I sent a simple reply to
> Yidong's message, which had the original bug subject:
> bug#3938: 23.0.96; regression: minibuffer-message interferes with C-u
>
> However, somehow my reply got interpreted as CLOSING the bug. Yidong had closed
> it.

Yes, he had sent a message to 3938-done <at> e.d.b. _and_ to you.  If you
reply to that, you need to edit out the "-done" part to prevent
re-closing the bug if you reopened it.

Since this is somewhat confusing, maybe it would be better to only send
bug closing messages to the nnnn-done address and not to the submitter
as well?

Sven



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3938; Package emacs. (Tue, 28 Jul 2009 22:05:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Tue, 28 Jul 2009 22:05:06 GMT) Full text and rfc822 format available.

Message #32 received at 3938 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Sven Joachim'" <svenjoac <at> gmx.de>
Cc: <3938 <at> debbugs.gnu.org>,
        "'Chong Yidong'" <cyd <at> stupidchicken.com>
Subject: RE: bug#3938: BUG system seems messed up - I did not close this bug
Date: Tue, 28 Jul 2009 14:59:49 -0700
> Yes, he had sent a message to 3938-done <at> e.d.b. _and_ to you.  If you
> reply to that, you need to edit out the "-done" part to prevent
> re-closing the bug if you reopened it.
> 
> Since this is somewhat confusing, maybe it would be better to 
> only send bug closing messages to the nnnn-done address and
> not to the submitter as well?
> 
> Sven

I see; thanks.

However, the submitter needs to be informed of a bug closing. What shouldn't
happen, perhaps, is to include all of the addresses in the same mail. Or,
better, the bug tracking system should use only instructions in the mail body to
close a bug - it shouldn't just close a bug if the address *-done is a
recipient. Anyway, I'll leave solving the bug-tracker problems to others more
qualified. Obviously, it is fragile, overly complex, and needs some improvement.

I hope that this bug (#3938) is still open for now, in any case.




Message #33 received at 3938-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: <3938-done <at> debbugs.gnu.org>
Subject: Re: bug#3938: 23.0.96; regression: minibuffer-message interferes with C-u
Date: Tue, 28 Jul 2009 21:03:45 -0400
"Drew Adams" <drew.adams <at> oracle.com> writes:

> Actually, I already had the call to `minibuffer-message' last, in my
> own code.
>
> ... we use an exact copy of `universal-argument-map' instead of
> `universal-argument-map' itself. That's the only change from vanilla
> Emacs (the definition of `my-ensure-overriding-map-is-bound' just
> reflects the vanilla definition).
>
> Same instructions as before: M-x C-u C-f, hitting C-f right after C-u
> (no delay) vs waiting until the 2-sec delay for `minibuffer-message'
> has elapsed.

If you want to hack universal-argument this way, you need to hack
sit-for as well: replace the last few lines of sit-for with

      (if (eq overriding-terminal-local-map my-universal-argument-map)
          (setq read (cons t read)))
      (push read unread-command-events)
      nil))))))



Message #34 received at 3938-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Chong Yidong'" <cyd <at> stupidchicken.com>
Cc: <3938-done <at> debbugs.gnu.org>
Subject: RE: bug#3938: 23.0.96; regression: minibuffer-message interferes with C-u
Date: Tue, 28 Jul 2009 23:54:13 -0700
> > Actually, I already had the call to `minibuffer-message' last, in my
> > own code.
> >
> > ... we use an exact copy of `universal-argument-map' instead of
> > `universal-argument-map' itself. That's the only change from vanilla
> > Emacs (the definition of `my-ensure-overriding-map-is-bound' just
> > reflects the vanilla definition).
> >
> > Same instructions as before: M-x C-u C-f, hitting C-f right 
> > after C-u (no delay) vs waiting until the 2-sec delay for
> > `minibuffer-message' has elapsed.
> 
> If you want to hack universal-argument this way, you need to hack
> sit-for as well: replace the last few lines of sit-for with
> 
>       (if (eq overriding-terminal-local-map my-universal-argument-map)
>           (setq read (cons t read)))
>       (push read unread-command-events)
>       nil))))))

I see. I will look into such a workaround when I get some time. However:


1. That kind of thing should not be necessary. Something has become overly
fragile or things have become overly coupled.

I'm not "hacking universal-argument this way" or in any way - I don't redefine
it. I just use a different binding for `C-u' and a different keymap from
`universal-argument-map'. (In the bug report I show that even an exact copy of
that map demonstrates the bug, but in my real code I do use a slightly different
map.)

All my code does is change the behavior of `C-u' during completion very
slightly, so that the prefix arg is echoed in the minibuffer using
`minibuffer-message'. IOW, instead of echoing "FOO" as in the bug report, it
shows the prefix arg. In Icicles, you can perform lots of operations during
completion, and you can use `C-u' with those operations.

That's true for vanilla Emacs too, but it's not as often that users use `C-u'
when editing minibuffer text. Because `C-u' is used more during completion,
Icicles shows the prefix value.


2. As I mentioned, the code for `sit-for' has not changed a bit between Emacs 22
and 23 (and my code works in Emacs 22-21-20). Something else must have changed.
There should be no need to replace any of the `sit-for' code. This should not be
happening. There should be no need for such jumping through hoops and redefining
multiple things.

I appreciate the workaround advice, and I'll look into it as a temporary Emacs
23 workaround. But how about fixing this regression? Interrupting `sit-for' with
user input should never cause the full `sit-for' delay to be waited out -
something is amiss. `sit-for' is not `sleep-for'.





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3938; Package emacs. (Wed, 29 Jul 2009 15:50:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 29 Jul 2009 15:50:05 GMT) Full text and rfc822 format available.

Message #39 received at 3938 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 3938 <at> debbugs.gnu.org, "'Sven Joachim'" <svenjoac <at> gmx.de>,
        "'Chong Yidong'" <cyd <at> stupidchicken.com>
Subject: Re: bug#3938: BUG system seems messed up - I did not close this bug
Date: Wed, 29 Jul 2009 11:43:30 -0400
> However, the submitter needs to be informed of a bug closing. What shouldn't

She is informed automatically by the bug-tracker.


        Stefan



bug reopened, originator not changed. Request was from "Drew Adams" <drew.adams <at> oracle.com> to control <at> emacsbugs.donarmstrong.com. (Mon, 03 Aug 2009 05:05:05 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3938; Package emacs. (Mon, 03 Aug 2009 05:25:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 03 Aug 2009 05:25:06 GMT) Full text and rfc822 format available.

Message #46 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <emacs-pretest-bug <at> gnu.org>, <3936 <at> debbugs.gnu.org>
Subject: bug#3938: 23.0.96; regression: minibuffer-message interferes with C-u
Date: Sun, 2 Aug 2009 22:14:59 -0700
Taking off the "3938-done" address, I forgot to add back the original
recipients, so this would get to the bug list. So here it is again, with the bug
list added back as recipient.

[It is really a shame that once someone closes a bug you can no longer just
reply to the message; you have to reopen the bug and change the recipients... I
replied, and my reply was recorded as _me_ closing the bug. What a lame UI...
And of course none of that meta-conversation was added to the bug thread, except
for a bit by Stefan, who no doubt thought to add the bug list as recipient.]

Anyway...

-----Original Message-----
From: Drew Adams Sent: Sunday, August 02, 2009 10:07 PM
To: 'Chong Yidong'
Subject: RE: bug#3938: 23.0.96; regression: minibuffer-message interferes with
C-u

> 1. That kind of thing should not be necessary. Something has 
> become overly fragile or things have become overly coupled.
> 
> I'm not "hacking universal-argument this way" or in any way - 
> I don't redefine it. I just use a different binding for `C-u' 
> and a different keymap from `universal-argument-map'. (In the 
> bug report I show that even an exact copy of that map 
> demonstrates the bug, but in my real code I do use a slightly 
> different map.)
> 
> All my code does is change the behavior of `C-u' during 
> completion very slightly, so that the prefix arg is echoed in 
> the minibuffer using `minibuffer-message'. IOW, instead of 
> echoing "FOO" as in the bug report, it shows the prefix arg. 
> In Icicles, you can perform lots of operations during 
> completion, and you can use `C-u' with those operations.
> 
> That's true for vanilla Emacs too, but it's not as often that 
> users use `C-u' when editing minibuffer text. Because `C-u' 
> is used more during completion, Icicles shows the prefix value.
> 
> 
> 2. As I mentioned, the code for `sit-for' has not changed a 
> bit between Emacs 22 and 23 (and my code works in Emacs 
> 22-21-20). Something else must have changed. There should be 
> no need to replace any of the `sit-for' code. This should not 
> be happening. There should be no need for such jumping 
> through hoops and redefining multiple things.
> 
> I appreciate the workaround advice, and I'll look into it as 
> a temporary Emacs 23 workaround. But how about fixing this 
> regression? Interrupting `sit-for' with user input should 
> never cause the full `sit-for' delay to be waited out - 
> something is amiss. `sit-for' is not `sleep-for'.

In case it helps, below is what my code really does, so you can see that I am in
no way changing the code of `universal-argument' etc. In each case, I write and
use my own function and my own keymap. The code is nearly the same as the
original, with the only real change (and the purpose) being to add a minibuffer
message that echoes the prefix arg.

I hope this regression will be fixed. Thanks.

Here you have my complete use of this, so you can better understand. Each
function is identical to the original, except in the minor ways indicated:

;; Use my map for overriding terminal local.
;; Same as the definition of `ensure-overriding-map-is-bound',
;; except for using the different map.
(defun icicle-ensure-overriding-map-is-bound ()
  (unless overriding-map-is-bound
   (setq saved-overriding-map           overriding-terminal-local-map
         overriding-terminal-local-map  icicle-universal-argument-map
         overriding-map-is-bound        t)))

;; Bound to `C-<0-9>', `M-<0-9>', `C-M-<0-9>' in minibuffer.
(defun icicle-digit-argument (arg)
  "`digit-argument', but also echo the prefix arg."
  (interactive "P")
  (let* ((char   (if (integerp last-command-char)
                     last-command-char
                   (get last-command-char 'ascii-character)))
         (digit  (- (logand char ?\177) ?0)))
    (cond ((integerp arg)
           (setq prefix-arg  (+ (* arg 10) (if (< arg 0) (- digit) digit))))
          ((eq arg '-)
           ;; Treat -0 as just -, so that -01 will work.
           (setq prefix-arg  (if (zerop digit) '- (- digit))))
          (t
           (setq prefix-arg  digit))))
  (setq universal-argument-num-events  (length (this-command-keys)))
  (icicle-ensure-overriding-map-is-bound)
  (icicle-msg-maybe-in-minibuffer "prefix %S" prefix-arg))

;; Bound to `M--', `C-M--' in minibuffer.
(defun icicle-negative-argument (arg)
  "`negative-argument', but also echo the prefix arg."
  (interactive "P")
  (cond ((integerp arg) (setq prefix-arg  (- arg)))
        ((eq arg '-) (setq prefix-arg  nil))
        (t (setq prefix-arg  '-)))
  (setq universal-argument-num-events  (length (this-command-keys)))
  (icicle-ensure-overriding-map-is-bound)
  (icicle-msg-maybe-in-minibuffer "prefix %S" prefix-arg))

; Bound to `C-u' in minibuffer.
(defun icicle-universal-argument ()
  "`universal-argument', but also echo the prefix arg."
  (interactive)
  (setq prefix-arg                     (list 4)
        universal-argument-num-events  (length (this-command-keys)))
  (icicle-ensure-overriding-map-is-bound)
  (icicle-msg-maybe-in-minibuffer "prefix %S" prefix-arg))

(defun icicle-universal-argument-more (arg)
  "`universal-argument-more', but also echo the prefix arg."
  (interactive "P")
  (universal-argument-more arg)
  (icicle-msg-maybe-in-minibuffer "prefix %S" prefix-arg))

(defun icicle-universal-argument-other-key (arg)
  "`universal-argument-other-key', but also echo the prefix."
  (interactive "P")
  (universal-argument-other-key arg)
  (icicle-msg-maybe-in-minibuffer "prefix %S" prefix-arg))

(defun icicle-universal-argument-minus (arg)
  "`universal-argument-minus', but also echo the prefix arg."
  (interactive "P")
  (universal-argument-minus arg)
  (icicle-msg-maybe-in-minibuffer "prefix %S" prefix-arg))

(defun icicle-msg-maybe-in-minibuffer (format-string &rest args)
  "Display FORMAT-STRING as a message.
If called with the minibuffer inactive, use `message'.
Otherwise, use `minibuffer-message'."
  (if (active-minibuffer-window)
      (save-selected-window
        (select-window (minibuffer-window))
        (minibuffer-message
         (apply #'format (concat "  [" format-string "]") args)))
    (apply #'message format-string args)))

;; Same code as that defining `universal-argument-map',
;; but with the above corresponding functions substituted.
(defvar icicle-universal-argument-map
  (let ((map  (make-sparse-keymap)))
    (define-key map [t] 'icicle-universal-argument-other-key)
    (define-key map (vector meta-prefix-char t)
                    'icicle-universal-argument-other-key)
    (define-key map [switch-frame] nil)
    (define-key map [?\C-u] 'icicle-universal-argument-more)
    (define-key map [?-] 'icicle-universal-argument-minus)
    (define-key map [?0] 'icicle-digit-argument)
    (define-key map [?1] 'icicle-digit-argument)
    (define-key map [?2] 'icicle-digit-argument)
    (define-key map [?3] 'icicle-digit-argument)
    (define-key map [?4] 'icicle-digit-argument)
    (define-key map [?5] 'icicle-digit-argument)
    (define-key map [?6] 'icicle-digit-argument)
    (define-key map [?7] 'icicle-digit-argument)
    (define-key map [?8] 'icicle-digit-argument)
    (define-key map [?9] 'icicle-digit-argument)
    (define-key map [kp-0] 'icicle-digit-argument)
    (define-key map [kp-1] 'icicle-digit-argument)
    (define-key map [kp-2] 'icicle-digit-argument)
    (define-key map [kp-3] 'icicle-digit-argument)
    (define-key map [kp-4] 'icicle-digit-argument)
    (define-key map [kp-5] 'icicle-digit-argument)
    (define-key map [kp-6] 'icicle-digit-argument)
    (define-key map [kp-7] 'icicle-digit-argument)
    (define-key map [kp-8] 'icicle-digit-argument)
    (define-key map [kp-9] 'icicle-digit-argument)
    (define-key map [kp-subtract] 'icicle-universal-argument-minus)
    map)
  "Keymap used while processing `C-u' during Icicles completion.")

;; Use my `C-u' during completion (only).
(define-key minibuffer-local-completion-map
            (vector 'remap 'universal-argument) 'icicle-universal-argument)

Besides this, I think that your suggested workaround has no chance of solving
the problem. The problem cannot be in `sit-for', since that code has not changed
between Emacs 22 and 23. And this bug is a regression wrt Emacs 22 (and 21,
20...).

Thanks for taking another look.




Merged 3938 5923. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 10 Feb 2014 05:23:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3938; Package emacs. (Tue, 05 Jul 2016 04:07:02 GMT) Full text and rfc822 format available.

Message #51 received at 3938 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 5923 <at> debbugs.gnu.org, 'Stefan Monnier' <monnier <at> iro.umontreal.ca>,
 3938 <at> debbugs.gnu.org
Subject: Re: bug#5923: 23.1.95; minibuffer-message discards input events
Date: Tue, 05 Jul 2016 00:06:20 -0400
"Drew Adams" <drew.adams <at> oracle.com> writes:

>> Actually, the problem is here in `sit-for':
>>
>> (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))))))
>> 
>> Since the value of `overriding-terminal-local-map' is not
>> `universal-argument-map' in my case, it fails to treat any 
>> input received properly.
>
> However, something else must be going on also, because the sit-for code is
> identical for Emacs 22, and I don't see the bug in Emacs 22.

Is this bug fixed?  The special casing of this in `sit-for' has been
removed meanwhile, but also the overriding-map-is-bound and
universal-argument-other-key have been removed, so it's hard to run the
code examples in current (version 25) Emacs.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3938; Package emacs. (Tue, 05 Jul 2016 14:20:01 GMT) Full text and rfc822 format available.

Message #54 received at 3938 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: npostavs <at> users.sourceforge.net
Cc: 5923 <at> debbugs.gnu.org, 3938 <at> debbugs.gnu.org
Subject: RE: bug#5923: 23.1.95; minibuffer-message discards input events
Date: Tue, 5 Jul 2016 14:19:28 +0000 (UTC)
> >> Actually, the problem is here in `sit-for':
> >>
> >> (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))))))
> >>
> >> Since the value of `overriding-terminal-local-map' is not
> >> `universal-argument-map' in my case, it fails to treat any
> >> input received properly.
> >
> > However, something else must be going on also, because the sit-for code is
> > identical for Emacs 22, and I don't see the bug in Emacs 22.
> 
> Is this bug fixed?  The special casing of this in `sit-for' has been
> removed meanwhile, but also the overriding-map-is-bound and
> universal-argument-other-key have been removed, so it's hard to run the
> code examples in current (version 25) Emacs.

I don't know if it is fixed, and I don't have the time to dig into
this again.  (What you quoted was by no means the last part of this
bug thread, BTW.)  I would _not_ assume that this bug has been fixed.
I think someone would need to dig into this, to debug it.

I provided a self-contained repro recipe based on the code at
the time, but it is no longer sufficient because variable
`overriding-map-is-bound' no longer exists, and the underlying
code has changed.

You can close the bug, but I'm not confident it has been fixed.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3938; Package emacs. (Wed, 06 Jul 2016 14:26:02 GMT) Full text and rfc822 format available.

Message #57 received at 3938 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 3938 <at> debbugs.gnu.org, 5923 <at> debbugs.gnu.org, npostavs <at> users.sourceforge.net
Subject: Re: bug#3938: bug#5923: 23.1.95;
 minibuffer-message discards input events
Date: Wed, 06 Jul 2016 17:25:03 +0300
[Message part 1 (text/plain, inline)]
> Date: Tue, 5 Jul 2016 14:19:28 +0000 (UTC)
> From: Drew Adams <drew.adams <at> oracle.com>
> Cc: 5923 <at> debbugs.gnu.org, 3938 <at> debbugs.gnu.org
> 
> > >> Actually, the problem is here in `sit-for':
> > >>
> > >> (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))))))
> > >>
> > >> Since the value of `overriding-terminal-local-map' is not
> > >> `universal-argument-map' in my case, it fails to treat any
> > >> input received properly.
> > >
> > > However, something else must be going on also, because the sit-for code is
> > > identical for Emacs 22, and I don't see the bug in Emacs 22.
> > 
> > Is this bug fixed?  The special casing of this in `sit-for' has been
> > removed meanwhile, but also the overriding-map-is-bound and
> > universal-argument-other-key have been removed, so it's hard to run the
> > code examples in current (version 25) Emacs.
> 
> I don't know if it is fixed, and I don't have the time to dig into
> this again.  (What you quoted was by no means the last part of this
> bug thread, BTW.)  I would _not_ assume that this bug has been fixed.
> I think someone would need to dig into this, to debug it.

One could hope for a more cooperative response, I think.  It took me
all of 5 minutes, without knowing anything about icicles and very
little about the new implementation of universal-argument, to convert
your test file to the current sources (see the attached).  With it, I
convinced myself that the bug is indeed fixed: typing the first 's'
interrupts the wait immediately, and displays "ssss" in the echo area.

Please verify that my changes to the test file are valid and the bug
is indeed fixed.

Thanks.

[bug-5923-emacs-25.el (application/emacs-lisp, attachment)]

Added tag(s) confirmed. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Wed, 06 Jul 2016 14:56:02 GMT) Full text and rfc822 format available.

bug Marked as found in versions 25.0.95. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Wed, 06 Jul 2016 14:56:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3938; Package emacs. (Wed, 06 Jul 2016 15:11:01 GMT) Full text and rfc822 format available.

Message #64 received at 3938 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 3938 <at> debbugs.gnu.org, 5923 <at> debbugs.gnu.org, npostavs <at> users.sourceforge.net
Subject: RE: bug#3938: bug#5923: 23.1.95; minibuffer-message discards input
 events
Date: Wed, 6 Jul 2016 15:10:35 +0000 (UTC)
> > > Is this bug fixed?  The special casing of this in `sit-for' has been
> > > removed meanwhile, but also the overriding-map-is-bound and
> > > universal-argument-other-key have been removed, so it's hard to run the
> > > code examples in current (version 25) Emacs.
> >
> > I don't know if it is fixed, and I don't have the time to dig into
> > this again.  (What you quoted was by no means the last part of this
> > bug thread, BTW.)  I would _not_ assume that this bug has been fixed.
> > I think someone would need to dig into this, to debug it.
> 
> One could hope for a more cooperative response, I think. 

Ditto.  Time passes...

> It took me all of 5 minutes, without knowing anything about icicles and very
> little about the new implementation of universal-argument, to convert
> your test file to the current sources (see the attached).  With it, I
> convinced myself that the bug is indeed fixed: typing the first 's'
> interrupts the wait immediately, and displays "ssss" in the echo area.

I had already done similarly, FWIW.  To me it does not constitute a proof
that the bug is fixed.  If it convinces you, fine; close the bug, as I said.

> Please verify that my changes to the test file are valid and the bug
> is indeed fixed.

Sorry, I don't have the time to do that.  And as I said, IMO this
alone doesn't convince me that the bug is fixed.  It might be fixed;
I don't know.  I hope it is.

If you can convince yourself in 5 minutes that it is fixed, great.

The bug (#3938) was filed almost exactly 7 years ago, with a very short
recipe to reproduce, starting from `emacs -Q'.  Likewise, for the merged
bug (#5923) - 6 years ago, with other emacs -Q recipes
(http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5923#23, http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5923#26).

Responses from Stefan at the time:

 But to tell you the truth the handling of this-command-keys and
 universal-argument prefix is much too delicate for me to understand it...

 Thank you for your efforts digging into this bug.  I must say I know
 even less than you do about those parts of the code.  It's clearly too
 intricate for its own good, but I don't know how to streamline it.

That was it.  It died on the vine in 2010.  If it somehow got fixed
accidentally in the interim, great.

"One could _hope_ for a more cooperative response, I think."
But all's well that ends well.  (Assuming it is ended, and well.)




Removed tag(s) confirmed. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Wed, 06 Jul 2016 15:32:01 GMT) Full text and rfc822 format available.

Added tag(s) fixed. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Wed, 06 Jul 2016 15:37:03 GMT) Full text and rfc822 format available.

bug No longer marked as found in versions 25.0.95. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Wed, 06 Jul 2016 15:37:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 5923 <at> debbugs.gnu.org and "Drew Adams" <drew.adams <at> oracle.com> Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Fri, 05 Aug 2016 01:24:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 02 Sep 2016 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 295 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.