GNU bug report logs - #44500
26.3; `prefix-command-echo-keystrokes-functions' causes regression

Previous Next

Package: emacs;

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

Date: Sat, 7 Nov 2020 06:49:02 UTC

Severity: normal

Tags: moreinfo

Found in version 26.3

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 44500 in the body.
You can then email your comments to 44500 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-gnu-emacs <at> gnu.org:
bug#44500; Package emacs. (Sat, 07 Nov 2020 06:49:02 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 bug-gnu-emacs <at> gnu.org. (Sat, 07 Nov 2020 06:49:02 GMT) Full text and rfc822 format available.

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

From: Drew Adams <drew.adams <at> oracle.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.3; `prefix-command-echo-keystrokes-functions' causes regression
Date: Fri, 6 Nov 2020 22:48:48 -0800 (PST)
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''




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44500; Package emacs. (Mon, 11 Oct 2021 12:36:03 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 44500 <at> debbugs.gnu.org
Subject: Re: bug#44500: 26.3; `prefix-command-echo-keystrokes-functions'
 causes regression
Date: Mon, 11 Oct 2021 05:35:19 -0700
tags 44500 + moreinfo
thanks

Drew Adams <drew.adams <at> oracle.com> writes:

> 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 ()
[...]
>
> 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.

Could you provide a minimal example to reproduce the issue?

> 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''




Added tag(s) moreinfo. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Mon, 11 Oct 2021 12:36:05 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44500; Package emacs. (Mon, 11 Oct 2021 14:57:02 GMT) Full text and rfc822 format available.

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

From: Drew Adams <drew.adams <at> oracle.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: "44500 <at> debbugs.gnu.org" <44500 <at> debbugs.gnu.org>
Subject: RE: [External] : Re: bug#44500: 26.3;
 `prefix-command-echo-keystrokes-functions' causes regression
Date: Mon, 11 Oct 2021 14:55:56 +0000
> tags 44500 + moreinfo

> > Here's the function I use:
> >
> > (defun bmkp-bmenu-read-filter-input ()
> [...]
> >
> > 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.
> 
> Could you provide a minimal example to reproduce the issue?

I think I've provided the info I have, and all
that should be needed to understand the problem.

> > 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.


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44500; Package emacs. (Tue, 09 Nov 2021 06:41:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: "44500 <at> debbugs.gnu.org" <44500 <at> debbugs.gnu.org>,
 Stefan Kangas <stefan <at> marxist.se>
Subject: Re: bug#44500: 26.3; `prefix-command-echo-keystrokes-functions'
 causes regression
Date: Tue, 09 Nov 2021 07:40:22 +0100
Drew Adams <drew.adams <at> oracle.com> writes:

>> > 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.
>> 
>> Could you provide a minimal example to reproduce the issue?
>
> I think I've provided the info I have, and all
> that should be needed to understand the problem.

More information was requested, but no response was given within a
month, so I'm closing this bug report.  If progress can be made,
please respond to this email and we'll reopen the bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 44500 <at> debbugs.gnu.org and Drew Adams <drew.adams <at> oracle.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 09 Nov 2021 06:41:02 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. (Tue, 07 Dec 2021 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 134 days ago.

Previous Next


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