GNU bug report logs - #46727
27.1; Only the first function from prefix-command-echo-keystrokes-functions is used

Previous Next

Package: emacs;

Reported by: Miha Rihtaršič <miha <at> kamnitnik.top>

Date: Tue, 23 Feb 2021 20:43:02 UTC

Severity: normal

Tags: fixed

Found in version 27.1

Fixed in version 28.1

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 46727 in the body.
You can then email your comments to 46727 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#46727; Package emacs. (Tue, 23 Feb 2021 20:43:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Miha Rihtaršič <miha <at> kamnitnik.top>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 23 Feb 2021 20:43:02 GMT) Full text and rfc822 format available.

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

From: Miha Rihtaršič <miha <at> kamnitnik.top>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.1; Only the first function from
 prefix-command-echo-keystrokes-functions is used
Date: Tue, 23 Feb 2021 21:44:29 +0100
[Message part 1 (text/plain, inline)]
Greetings.

Looking at the function internal-echo-keystrokes-prefix, it is heavily
implied that all functions from
`prefix-command-echo-keystrokes-functions` should be used and their
return values concatenated. This isn't the case, however, because
`run-hook-wrapped` aborts on first non-nil returned value. The following
simple patch fixes this.

diff --git a/lisp/simple.el b/lisp/simple.el
index 1dfc3374ad..403861351c 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4670,7 +4670,7 @@ internal-echo-keystrokes-prefix
     (setq prefix-command--last-echo
           (let ((strs nil))
             (run-hook-wrapped 'prefix-command-echo-keystrokes-functions
-                              (lambda (fun) (push (funcall fun) strs)))
+                              (lambda (fun) (push (funcall fun) strs) nil))
             (setq strs (delq nil strs))
             (when strs (mapconcat #'identity strs " "))))))
 

[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46727; Package emacs. (Wed, 24 Feb 2021 16:43:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Miha Rihtaršič <miha <at> kamnitnik.top>
Cc: 46727 <at> debbugs.gnu.org
Subject: Re: bug#46727: 27.1; Only the first function from
 prefix-command-echo-keystrokes-functions is used
Date: Wed, 24 Feb 2021 17:42:03 +0100
Miha Rihtaršič <miha <at> kamnitnik.top> writes:

> Greetings.
>
> Looking at the function internal-echo-keystrokes-prefix, it is heavily
> implied that all functions from
> `prefix-command-echo-keystrokes-functions` should be used and their
> return values concatenated. This isn't the case, however, because
> `run-hook-wrapped` aborts on first non-nil returned value. The following
> simple patch fixes this.

[...]

>              (run-hook-wrapped 'prefix-command-echo-keystrokes-functions
> -                              (lambda (fun) (push (funcall fun) strs)))
> +                              (lambda (fun) (push (funcall fun) strs) nil))

Thanks.

I poked around in the code, and I think your interpretation here must be
correct, and I've applied your patch to Emacs 28.  (Besides, `push' has
an undefined return value...  and always returns non-nil, so the old
code would, as you said, never use more than the first function in
`prefix-command-echo-keystrokes-functions'.)

This change was small enough to apply without assigning copyright to the
FSF, but for future patches you want to submit, it might make sense to
get the paperwork started now, so that subsequent patches can be applied
speedily. Would you be willing to sign such paperwork?

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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 24 Feb 2021 16:43:01 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 46727 <at> debbugs.gnu.org and Miha Rihtaršič <miha <at> kamnitnik.top> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 24 Feb 2021 16:43:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46727; Package emacs. (Wed, 24 Feb 2021 19:21:02 GMT) Full text and rfc822 format available.

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

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 46727 <at> debbugs.gnu.org,
 Miha Rihtaršič <miha <at> kamnitnik.top>
Subject: Re: bug#46727: 27.1; Only the first function from
 prefix-command-echo-keystrokes-functions is used
Date: Wed, 24 Feb 2021 19:19:55 +0000
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> (Besides, `push' has an undefined return value...

(Except it's defined as being equivalent to (setf T (cons H T)) ;)

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46727; Package emacs. (Wed, 24 Feb 2021 19:35:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 46727 <at> debbugs.gnu.org,
 Miha Rihtaršič <miha <at> kamnitnik.top>
Subject: Re: bug#46727: 27.1; Only the first function from
 prefix-command-echo-keystrokes-functions is used
Date: Wed, 24 Feb 2021 20:33:47 +0100
"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:

> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
>> (Besides, `push' has an undefined return value...
>
> (Except it's defined as being equivalent to (setf T (cons H T)) ;)

The doc string says that it's "morally equivalent", but the return value
is left undefined by (Stefan M's) choice, if I recall correctly from a
discussion from some decades ago.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46727; Package emacs. (Wed, 24 Feb 2021 20:02:02 GMT) Full text and rfc822 format available.

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

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 46727 <at> debbugs.gnu.org,
 Miha Rihtaršič <miha <at> kamnitnik.top>
Subject: Re: bug#46727: 27.1; Only the first function from
 prefix-command-echo-keystrokes-functions is used
Date: Wed, 24 Feb 2021 20:01:38 +0000
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> "Basil L. Contovounesios" <contovob <at> tcd.ie> writes:
>
>> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>>
>>> (Besides, `push' has an undefined return value...
>>
>> (Except it's defined as being equivalent to (setf T (cons H T)) ;)
>
> The doc string says that it's "morally equivalent", but the return value
> is left undefined by (Stefan M's) choice, if I recall correctly from a
> discussion from some decades ago.

Its manual entry is not as weak in its choice of words.

-- 
Basil




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 25 Mar 2021 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 24 days ago.

Previous Next


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