unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Leo <sdl.web@gmail.com>
To: 6883@debbugs.gnu.org
Cc: thierry.volpiatto@gmail.com
Subject: bug#6883: 23.2; `read-key' echos keys in the minibuffer
Date: Thu, 19 Aug 2010 16:20:38 +0100	[thread overview]
Message-ID: <m1tymqr5mh.fsf@cam.ac.uk> (raw)


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





             reply	other threads:[~2010-08-19 15:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-19 15:20 Leo [this message]
2010-08-21  7:52 ` bug#6883: 23.2; `read-key' echos keys in the minibuffer Stefan Monnier
2010-08-21  8:23   ` Leo
2010-08-21  9:00     ` Stefan Monnier
2010-08-21 10:28     ` Thierry Volpiatto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1tymqr5mh.fsf@cam.ac.uk \
    --to=sdl.web@gmail.com \
    --cc=6883@debbugs.gnu.org \
    --cc=thierry.volpiatto@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).