From: Drew Adams <drew.adams@oracle.com>
To: 44500@debbugs.gnu.org
Subject: bug#44500: 26.3; `prefix-command-echo-keystrokes-functions' causes regression
Date: Fri, 6 Nov 2020 22:48:48 -0800 (PST) [thread overview]
Message-ID: <31fd423d-02ea-4a0e-992e-d226108d1c07@default> (raw)
This variable was introduced in Emacs 25, apparently.
I'm not happy that it's used/implemented the way it is, by default. I
have a function that calls `read-char' in a loop, and it took me a while
to figure out why this code broke starting with Emacs 25. That function
is called by a command bound to `P B', where `P' is a prefix key.
I'm not sure why, based on the doc of the variable etc., but even though
`P B' is not itself a prefix key, the default value of the variable
interfered with the normal behavior in the echo area. After finding out
the cause, I now bind the var to nil in that part of my code. But this
variable shouldn't have the effect it has, IMO.
Here's the function I use:
(defun bmkp-bmenu-read-filter-input ()
"Read input and add it to `bmkp-bmenu-filter-pattern'."
(setq bmkp-bmenu-filter-pattern "")
(let ((curr-bmk (bookmark-bmenu-bookmark)))
(when (eq 'QUIT
(let ((tmp-list ())
(bmkp-bmenu-title bmkp-bmenu-title)
(bmkp-bmenu-filter-function bmkp-bmenu-filter-function)
(inhibit-quit t)
;; Had to add this binding to counteract the regression.
;; (prefix-command-echo-keystrokes-functions ())
char)
(catch 'bmkp-bmenu-read-filter-input
(while (condition-case nil
(setq char (read-char
(concat "Pattern: "
bmkp-bmenu-filter-pattern)))
;; `read-char' raises an error for non-char event.
(error (throw 'bmkp-bmenu-read-filter-input nil)))
(unless (or (not (fboundp 'characterp))
(characterp char)) ; E.g. `M-x', `M-:'
(throw 'bmkp-bmenu-read-filter-input nil))
(case char
((?\e ?\r) (throw 'bmkp-bmenu-read-filter-input nil))
(?\C-g (setq inhibit-quit nil)
(throw 'bmkp-bmenu-read-filter-input 'QUIT))
(?\d (or (null tmp-list)
(pop tmp-list)
t))
(t (push (text-char-description char)
tmp-list)))
(setq bmkp-bmenu-filter-pattern
(mapconcat #'identity (reverse tmp-list) ""))))))
(message "Restoring display prior to incremental filtering...")
(bookmark-bmenu-list 'FILTEREDP)
(bmkp-bmenu-goto-bookmark-named curr-bmk)
(message "Restoring display prior to incremental filtering...done"))))
This code worked fine prior to Emacs 25. Starting with that release I
had to bind `prefix-command-echo-keystrokes-functions' to nil. I
shouldn't have had to do that.
If I don't add that binding, then:
You don't always even see the prompt "Pattern: <etc.>". Dunno why.
Instead, you see `P-', then `P B-', as if `P B' were a prefix key (only
`P' is a prefix key), and each char you type is also echoed as if it
were part of a prefix key, i.e., it's followed by a hyphen.
So if you type "red" after the (invisible) prompt, you see `P B r-',
then `P B r e-', then `P B r e d-'. You should instead see `Pattern: r',
then `Pattern: re', then `Pattern: red'.
Binding the variable to nil fixes the problem. But this behavior is a
bug, IMO, and the introduction of the variable shouldn't have changed
the default echo-area behavior of Emacs.
Hope the problem description is clear enough.
In GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)
of 2019-08-29
Repository revision: 96dd0196c28bc36779584e47fffcca433c9309cd
Windowing system distributor `Microsoft Corp.', version 10.0.18362
Configured using:
`configure --without-dbus --host=x86_64-w64-mingw32
--without-compress-install 'CFLAGS=-O2 -static -g3''
next reply other threads:[~2020-11-07 6:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-07 6:48 Drew Adams [this message]
2021-10-11 12:35 ` bug#44500: 26.3; `prefix-command-echo-keystrokes-functions' causes regression Stefan Kangas
2021-10-11 14:55 ` bug#44500: [External] : " Drew Adams
2021-11-09 6:40 ` Lars Ingebrigtsen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=31fd423d-02ea-4a0e-992e-d226108d1c07@default \
--to=drew.adams@oracle.com \
--cc=44500@debbugs.gnu.org \
/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 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.