bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#51173: 28.0.60; gnus-article-describe-key doesn't work


From: Stefan Monnier
Subject: bug#51173: 28.0.60; gnus-article-describe-key doesn't work
Date: Sat, 16 Oct 2021 15:53:03 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>>> +     (let* ((key (read-key-sequence nil t))
>>> +                 (buffer (if (consp key)
>>> +                             (window-buffer (posn-window (event-start 
>>> key)))
>>> +                           (current-buffer))))
>>> +            (describe-key key buffer))))
>>
>> I think the first `describe-key` above should always use
>> `current-buffer` (that's the whole point of the function: to lookup the
>> keybinding in that other buffer).
>
> There is still something missing: `gnus-article-describe-key`
> already selects the required buffer with `with-current-buffer`.
> Then why should it provide the same buffer as an argument
> to `describe-key` to select it again in `describe-key`?

Because `describe-key` otherwise uses the buffer of the window
associated with the event (this is in done in `help--analyse-key` where
we currently use `mouse-set-point`).  So we need to pass an explicit
buffer to tell `describe-key` to ignore the event's window (and we need
to change this part of `describe-key/help--analyse-key` to obey such a
buffer argument).

> Maybe you intended to add a new argument `buffer` to pass it down
> to `help--analyze-key` that could use it somehow in this condition:
>
>          (defn (if (consp event)
>                    (save-excursion (mouse-set-point event) (key-binding key 
> t))
>                  (key-binding key t)))

Yes.

> But I have no idea how.  Maybe not to set point (that also selects
> another window) when the `buffer` arg is provided?

Exactly.

>          (defn (if (not buffer)
>                    (save-excursion (mouse-set-point event) (key-binding key 
> t))
>                  (key-binding key t)))
>
> IOW, the semantics of `buffer` is not clear here.

If nil it means "defaults to the (window-buffer (posn-window (event-end 
event)))"

>> OTOH we should probably try and change the `key` arg to use the new
>> key-list format expected by `describe-key` (i.e. a list of (SEQ
>> . RAW-SEQ) pairs).
>
> `gnus-article-describe-key` just passes down the value
> that `read-key-sequence` returns.

I know.  This is the old calling convention of `describe-key`; we
should move to the new one.


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]