[Top][All Lists]

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

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

From: Arthur Miller
Subject: Re: bug#36767: 26.1; request: add more quick keys to the *Help* buffer
Date: Fri, 24 Sep 2021 21:34:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Juri Linkov <juri@linkov.net> writes:

>> I came up with another idea last night and sent a patch, but I am not sure 
>> if it
>> got to right place, I don't see it myself. It was an answer longer in the 
>> thread
>> to Lars.
>> This one makes it possible to run any command in *Help* buffer, not just 
>> those
>> defined in help-mode.el, and those not need any patching or wrapping of 
>> existing
>> commands.
>> I don't know if it is correct place to put define-key for the global map, 
>> and I
>> am not sure if C-h M-h is the right, but that's just a detail.
> This would be a nice command.  But why it's limited only to help-window?
> It could allow reading and running the key sequences in any next-window.

Yeah, sure, you could have it for next, previous or one found via
compleating-read, ot any buffer you can make current. 

This was meant as a quick fix to control help buffer so we don't need
to switch back and forth.

>> +(defun help-do-command ()
>> +  "Run a key-sequence in \"*Help*\" buffer from other buffers.
>> +
>> +If *Help* buffer is not visible, the HELP-DO-COMMAND will be aborterd."
>> +  (interactive)
>> +  (if (get-buffer-window (help-buffer))
> I meant to replace '(get-buffer-window (help-buffer))' with '(next-window)'.

Next-window could be anything, it could be just as annoying as switching
forth-and back, so I think it is better to have a specialized function that
works only on this buffer.
>> +      (let ((__key (read-key-sequence "Run command in *Help* buffer: ")))
>> +        (with-current-buffer (help-buffer)
>> +          (call-interactively
>> +           (key-binding
>> +            (kbd (edmacro-format-keys (vector last-input-event)))))))
>> +    (call-interactively (global-key-binding "\C-g"))))
>> +
>> +(define-key global-map (kbd "C-h M-h") 'help-do-command)

This was a quick fix, I just came up with that idea based on what I suggested
earlier, but sure it can be generalized. I think personally it is better that
every mode exports a named function, like foo-do-command or something, but one
where user chooses a buffer and one 'dwim' style one there are only two buffers
would be good to have too.

By the way, this let statement is unnecessary too, it is a leftover from 

reply via email to

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