all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#46727: 27.1; Only the first function from prefix-command-echo-keystrokes-functions is used
@ 2021-02-23 20:44 Miha Rihtaršič
  2021-02-24 16:42 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Miha Rihtaršič @ 2021-02-23 20:44 UTC (permalink / raw)
  To: 46727

[-- Attachment #1: Type: text/plain, Size: 944 bytes --]


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 " "))))))
 


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

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

* bug#46727: 27.1; Only the first function from prefix-command-echo-keystrokes-functions is used
  2021-02-23 20:44 bug#46727: 27.1; Only the first function from prefix-command-echo-keystrokes-functions is used Miha Rihtaršič
@ 2021-02-24 16:42 ` Lars Ingebrigtsen
  2021-02-24 19:19   ` Basil L. Contovounesios
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-24 16:42 UTC (permalink / raw)
  To: Miha Rihtaršič; +Cc: 46727

Miha Rihtaršič <miha@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





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

* bug#46727: 27.1; Only the first function from prefix-command-echo-keystrokes-functions is used
  2021-02-24 16:42 ` Lars Ingebrigtsen
@ 2021-02-24 19:19   ` Basil L. Contovounesios
  2021-02-24 19:33     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Basil L. Contovounesios @ 2021-02-24 19:19 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 46727, Miha Rihtaršič

Lars Ingebrigtsen <larsi@gnus.org> writes:

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

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

-- 
Basil





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

* bug#46727: 27.1; Only the first function from prefix-command-echo-keystrokes-functions is used
  2021-02-24 19:19   ` Basil L. Contovounesios
@ 2021-02-24 19:33     ` Lars Ingebrigtsen
  2021-02-24 20:01       ` Basil L. Contovounesios
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-24 19:33 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 46727, Miha Rihtaršič

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> Lars Ingebrigtsen <larsi@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





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

* bug#46727: 27.1; Only the first function from prefix-command-echo-keystrokes-functions is used
  2021-02-24 19:33     ` Lars Ingebrigtsen
@ 2021-02-24 20:01       ` Basil L. Contovounesios
  0 siblings, 0 replies; 5+ messages in thread
From: Basil L. Contovounesios @ 2021-02-24 20:01 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 46727, Miha Rihtaršič

Lars Ingebrigtsen <larsi@gnus.org> writes:

> "Basil L. Contovounesios" <contovob@tcd.ie> writes:
>
>> Lars Ingebrigtsen <larsi@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





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

end of thread, other threads:[~2021-02-24 20:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-23 20:44 bug#46727: 27.1; Only the first function from prefix-command-echo-keystrokes-functions is used Miha Rihtaršič
2021-02-24 16:42 ` Lars Ingebrigtsen
2021-02-24 19:19   ` Basil L. Contovounesios
2021-02-24 19:33     ` Lars Ingebrigtsen
2021-02-24 20:01       ` Basil L. Contovounesios

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.