Subject: Re: bug#36767: 26.1; request: add more quick keys to the *Help* buffer

From: Stephen Berman <[email-masked]>
Date: Fri, 18 Jun 2021 18:02:54 +0200

On Fri, 18 Jun 2021 17:45:13 +0300 Eli Zaretskii <[email-masked]> wrote:

>> From: Stephen Berman <[email-masked]>
>> Cc: Robert Pluim <[email-masked]>,  [email-masked],
>>   [email-masked],  [email-masked],  [email-masked]
>> Date: Fri, 18 Jun 2021 16:32:23 +0200
>>
>> > The nuisance is to have to switch to the Help window.  That variable
>> > saves the command to switch to it, but it doesn't change the fact that
>> > you are no longer in your original window/buffer.  Viewing help
>> > shouldn't interfere with the window/buffer where you do your main
>> > work, IMO.
>>
>> I'm using this:
>>
>> (defun srb-quit-help (&optional any-frame)
>>   "Quit *Help* buffer without selecting it.
>> With prefix argument ANY-FRAME quit *Help* on any visible frame,
>
> Thanks.  But what I'd like to have is not a way of burying the Help
> window, because I frequently need to consult it for quite some time.
> What I'd like to have is a way of using its buttons without going to
> that other window first.  For example, I'd love a command, bound to a
> key globally, that would display the source of the function in the
> same window as the Help window, then allow me to go back to the Help
> window.

The command `help-view-source' that Lars recently added could probably
help here, with some tweaking.  It calls
help-function-def--button-function, which calls pop-to-buffer with no
ACTION argument, which results in the source buffer being displayed a
different window than the *Help* buffer's window.  So the first
adjustment would be to add an optional ACTION argument.  As far a
returning from the source file to the *Help* buffer, the easiest way I
can think of to do that is if the source file is visited in View mode:
then `q' would bury its buffer, returning to *Help* (I think).  Or would
that not satisfy your use case?  In any case, such a change to
help-function-def--button-function would probably be undesirable in
other cases, so rather than changing that function it would probably be
better to add a new function using the ACTION argument and View mode.
Then that would need to be wrapped in a command like the one I suggested
to use it outside of *Help*, and likewise for View-quit.  That's
starting to sound rather brittle, so maybe it's not a good idea after
all.

Steve Berman