GNU bug report logs - #6883
23.2; `read-key' echos keys in the minibuffer

Previous Next

Package: emacs;

Reported by: Leo <sdl.web <at> gmail.com>

Date: Thu, 19 Aug 2010 15:20:03 UTC

Severity: normal

Found in version 23.2

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

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 6883 in the body.
You can then email your comments to 6883 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 owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6883; Package emacs. (Thu, 19 Aug 2010 15:20:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 19 Aug 2010 15:20:03 GMT) Full text and rfc822 format available.

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

From: Leo <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, thierry.volpiatto <at> gmail.com
Subject: 23.2; `read-key' echos keys in the minibuffer
Date: Thu, 19 Aug 2010 16:20:38 +0100
1. Define bookmark-read-search-input as this which inserts a (sit-for 1) to
demonstrate the bug easily:

(defun bookmark-read-search-input ()
  (let ((prompt       (propertize "Pattern: " 'face 'minibuffer-prompt))
        (tmp-list     ()))
    (while
        (let ((char (read-key (concat prompt bookmark-search-pattern))))
          (sit-for 1)
          (case char
            ((?\e ?\r) nil) ; RET or ESC break the search loop.
            (?\C-g (setq bookmark-quit-flag t) nil)
            (?\d (pop tmp-list) t) ; Delete last char of pattern with DEL
            (t
             (if (characterp char)
                 (push char tmp-list)
               (setq unread-command-events
                     (nconc (mapcar 'identity
                                    (this-single-command-raw-keys))
                            unread-command-events))
               nil))))
      (setq bookmark-search-pattern
            (apply 'string (reverse tmp-list))))))

2. and eval

  (let (bookmark-search-pattern) (bookmark-read-search-input))

3. then start typing away.

You should see each key is echoed. So for example if you hit backspace
you may see backspace or DEL in the echo area twice.

With the original definition back (ie without the sit-for) you can
observe a trail for each key you type by for example doing something
like this:

  1. C-x r l to list bookmarks
  2. M-g s and start typing away

That breaks the smooth flow of key strokes.

Thierry Volpiatto, YAMAMOTO Mitsuharu and I can observe this on all
three major platforms. On some platforms, it happens so fast that it is
hardly annoying, on others you can read the echoing literally.
`read-char' does not have this problem and thus Thierry's suggestion to
use it instead.

Leo




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6883; Package emacs. (Sat, 21 Aug 2010 07:52:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo <sdl.web <at> gmail.com>
Cc: bug-gnu-emacs <at> gnu.org, thierry.volpiatto <at> gmail.com
Subject: Re: 23.2; `read-key' echos keys in the minibuffer
Date: Sat, 21 Aug 2010 09:52:37 +0200
Does the trivial patch below fix the problem?


        Stefan


=== modified file 'lisp/subr.el'
--- lisp/subr.el	2010-07-10 18:52:53 +0000
+++ lisp/subr.el	2010-08-21 07:45:07 +0000
@@ -1818,6 +1818,7 @@
 some sort of escape sequence, the ambiguity is resolved via `read-key-delay'."
   (let ((overriding-terminal-local-map read-key-empty-map)
 	(overriding-local-map nil)
+        (echo-keystrokes 0)
 	(old-global-map (current-global-map))
         (timer (run-with-idle-timer
                 ;; Wait long enough that Emacs has the time to receive and





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6883; Package emacs. (Sat, 21 Aug 2010 08:23:02 GMT) Full text and rfc822 format available.

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

From: Leo <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: bug-gnu-emacs <at> gnu.org, thierry.volpiatto <at> gmail.com
Subject: Re: 23.2; `read-key' echos keys in the minibuffer
Date: Sat, 21 Aug 2010 09:23:37 +0100
On 2010-08-21 08:52 +0100, Stefan Monnier wrote:
> Does the trivial patch below fix the problem?
>
>         Stefan
>
> === modified file 'lisp/subr.el'
> --- lisp/subr.el	2010-07-10 18:52:53 +0000
> +++ lisp/subr.el	2010-08-21 07:45:07 +0000
> @@ -1818,6 +1818,7 @@
>  some sort of escape sequence, the ambiguity is resolved via `read-key-delay'."
>    (let ((overriding-terminal-local-map read-key-empty-map)
>  	(overriding-local-map nil)
> +        (echo-keystrokes 0)
>  	(old-global-map (current-global-map))
>          (timer (run-with-idle-timer
>                  ;; Wait long enough that Emacs has the time to receive and
>

Yes and thanks.

Leo




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6883; Package emacs. (Sat, 21 Aug 2010 10:31:02 GMT) Full text and rfc822 format available.

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

From: Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#6883: 23.2; `read-key' echos keys in the minibuffer
Date: Sat, 21 Aug 2010 12:28:43 +0200
Leo <sdl.web <at> gmail.com> writes:

> On 2010-08-21 08:52 +0100, Stefan Monnier wrote:
>> Does the trivial patch below fix the problem?
>>
>>         Stefan
>>
>> === modified file 'lisp/subr.el'
>> --- lisp/subr.el	2010-07-10 18:52:53 +0000
>> +++ lisp/subr.el	2010-08-21 07:45:07 +0000
>> @@ -1818,6 +1818,7 @@
>>  some sort of escape sequence, the ambiguity is resolved via `read-key-delay'."
>>    (let ((overriding-terminal-local-map read-key-empty-map)
>>  	(overriding-local-map nil)
>> +        (echo-keystrokes 0)
>>  	(old-global-map (current-global-map))
>>          (timer (run-with-idle-timer
>>                  ;; Wait long enough that Emacs has the time to receive and
>>
>
> Yes and thanks.

Glad this is fixed, thanks Stefan.

-- 
Thierry Volpiatto
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 





Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Sat, 21 Aug 2010 13:09:02 GMT) Full text and rfc822 format available.

Notification sent to Leo <sdl.web <at> gmail.com>:
bug acknowledged by developer. (Sat, 21 Aug 2010 13:09:02 GMT) Full text and rfc822 format available.

Message #19 received at 6883-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo <sdl.web <at> gmail.com>
Cc: thierry.volpiatto <at> gmail.com
Subject: Re: 23.2; `read-key' echos keys in the minibuffer
Date: Sat, 21 Aug 2010 11:00:15 +0200
>> Does the trivial patch below fix the problem?
> Yes and thanks.

Great, I've installed it in the emacs-23 branch,


        Stefan




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

This bug report was last modified 14 years and 278 days ago.

Previous Next


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