all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#6883: 23.2; `read-key' echos keys in the minibuffer
@ 2010-08-19 15:20 Leo
  2010-08-21  7:52 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Leo @ 2010-08-19 15:20 UTC (permalink / raw)
  To: 6883; +Cc: thierry.volpiatto


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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#6883: 23.2; `read-key' echos keys in the minibuffer
  2010-08-19 15:20 bug#6883: 23.2; `read-key' echos keys in the minibuffer Leo
@ 2010-08-21  7:52 ` Stefan Monnier
  2010-08-21  8:23   ` Leo
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2010-08-21  7:52 UTC (permalink / raw)
  To: Leo; +Cc: bug-gnu-emacs, thierry.volpiatto

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






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#6883: 23.2; `read-key' echos keys in the minibuffer
  2010-08-21  7:52 ` Stefan Monnier
@ 2010-08-21  8:23   ` Leo
  2010-08-21  9:00     ` Stefan Monnier
  2010-08-21 10:28     ` Thierry Volpiatto
  0 siblings, 2 replies; 5+ messages in thread
From: Leo @ 2010-08-21  8:23 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: bug-gnu-emacs, thierry.volpiatto

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#6883: 23.2; `read-key' echos keys in the minibuffer
  2010-08-21  8:23   ` Leo
@ 2010-08-21  9:00     ` Stefan Monnier
  2010-08-21 10:28     ` Thierry Volpiatto
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2010-08-21  9:00 UTC (permalink / raw)
  To: Leo; +Cc: thierry.volpiatto

>> Does the trivial patch below fix the problem?
> Yes and thanks.

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


        Stefan





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#6883: 23.2; `read-key' echos keys in the minibuffer
  2010-08-21  8:23   ` Leo
  2010-08-21  9:00     ` Stefan Monnier
@ 2010-08-21 10:28     ` Thierry Volpiatto
  1 sibling, 0 replies; 5+ messages in thread
From: Thierry Volpiatto @ 2010-08-21 10:28 UTC (permalink / raw)
  To: bug-gnu-emacs

Leo <sdl.web@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 






^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-08-21 10:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-19 15:20 bug#6883: 23.2; `read-key' echos keys in the minibuffer Leo
2010-08-21  7:52 ` Stefan Monnier
2010-08-21  8:23   ` Leo
2010-08-21  9:00     ` Stefan Monnier
2010-08-21 10:28     ` Thierry Volpiatto

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.