Subject: Re: bug#71117: 30.0.50; output of describe-function

From: Andrea Corallo <[email-masked]>
Date: Tue, 28 May 2024 18:25:05 -0400

Kévin Le Gouguec <[email-masked]> writes:

> Andrea Corallo <[email-masked]> writes:
>
>> Eli Zaretskii <[email-masked]> writes:
>>
>>>> From: Andrea Corallo <[email-masked]>
>>>> Cc: Kévin Le Gouguec <[email-masked]>,
>>>>   [email-masked],
>>>>   [email-masked]
>>>> Date: Tue, 28 May 2024 13:44:33 -0400
>>>> 
>>>> >> Were you thinking of a command that specifically targets the symbol from
>>>> >> a displayed *Help* buffer, so the user would do e.g.
>>>> >> 
>>>> >> C-h v VAR RET   ; shows *Help* for VAR
>>>> >> C-h SOMETHING   ; finds source for VAR
>>>> >> 
>>>> >> where C-h SOMETHING's implementation would do (a smarter version of)
>>>> >> (with-current-buffer "*Help*"
>>>> >>   (help-view-source))
>>>> >> 
>>>> >> ?
>>>> >
>>>> > Yes, exactly.
>>>> 
>>>> Something like the attached?
>>>> 
>>>> It makes C-h z FUNCTION find the source for FUNCTION.
>>>
>>> I might be mistaken, but I don't think this is what I had in mind.
>>
>> You are not.
>>
>>> My use case is exactly like described above: I type "C-h v" or "C-h
>>> f", which displays the *Help* buffer in the other window.  Then I want
>>> to go to the source where the variable or function are defined, but
>>> without the need to switch to the window showing *Help*.
>>
>> The attached is my understanding of what we want (still using C-h z).
>> Kévin's mail make me suspect I've been too naive but anyway 😅...
>
> I don't actually have concrete examples where my allegedly-not-so-smart
> serving suggestion might fail 😉 The best I can come up with are
> what-ifs, e.g. "what if a user advises describe-* functions to rename
> *Help* buffers to something non-standard like *Help <SYM>*"; my answer
> then would be "describe-* commands could set some variable,
> e.g. last-help-buffer, that 'C-h z' could then consult".
>
> That's if we cared to support this kind of edge case, of course.

I thought about the variable but I didn't like to have to maintain a
status more (ie clean the variable when *Help* is killed).  OTOH in
help-fns-tests.el we already have a good number of hard-coded '*Help*'
around, so I think the current status quo is that we don't care.

> Re. the binding: if we are entering "Do Something With That Help Buffer
> I Just Invoked"-land, I wonder if we should stop at view-source; I could
> imagine users wanting to do other useful things like goto-info or
> customize.  In which case maybe we can find a mnemonic prefix to tuck
> all these actions?
>
> Thinking of e.g. 'C-h 4' (for the "other-window" connotation) or 'C-h H'
> (for "current _H_elp buffer"); help-find-source would then be bound to
> 'C-h 4 s', for example.
>
> (info-other-window currently hogs 'C-h 4 i' unfortunately… though
> nowadays 'C-x 4 4 i' also works, and 'C-x 4 i' is currently free 🤔
>
> 'C-x 4 h' is also free to use as a prefix, but maybe a bit of a
> fingerful)
>
> Don't give too much weight to my ramblings; I find 'C-h z' a bit
> cryptic, but I don't know that my alternatives are better.

I think those are actually good points, 'C-h z' is not very nice and
'C-h 4 s' would be probably easier to remember as 's' has the same
meaning in the *Help* buffer it-self.

  Andrea