emacs-devel
[Top][All Lists]
Advanced

[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 22:20:52 +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.
>
>> +(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)'.
>
>> +      (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)

What I meant in last mail was something like this:

#+begin_src emacs-lisp
(defun remote-control (buffer-or-buffer-name)
  (let ((buffer (if (stringp buffer-or-buffer-name)
                  (get-buffer buffer-or-buffer-name))))
    (if (and buffer (get-buffer-window buffer))
          (progn
            (read-key-sequence (format "Run command in %s buffer: "
                                       (buffer-name buffer)))
            (with-current-buffer buffer
              (call-interactively
               (key-binding
                (kbd (edmacro-format-keys (vector last-input-event)))))))
      (keyboard-quit))))

(defun help-remote-me ()
  (interactive)
  (remote-control (help-buffer)))
#+end_src

'remote-control' is one that does all the work. There could be
remote-control-other-window-dwim similar as for dired. It is limited to
visible windows, I think it would be easy to make misstakes if operatin on
unvisible windows. Also note while this has utility, it can be a bit confusing.
Anything that moves cursor around will be confusing since cursor is not moving
in remote window, so visual feedback is not always there.

If it would be interesting to develop furhter, where would it belong?
Windmove.el or elswehere?




reply via email to

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