From 77c404012dee603435b51b6a55be8700ce34a665 Mon Sep 17 00:00:00 2001 From: Arthur Miller Date: Fri, 24 Sep 2021 02:09:42 +0200 Subject: [PATCH] Send input to help-buffer form any buffer * help-mode.el (help-do-command): New command. Install help-do-command in global-map on C-h M-h key. --- lisp/help-mode.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 551cf7e1a3..a150cfa15b 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -875,6 +875,20 @@ help-insert-string (with-output-to-temp-buffer (help-buffer) (insert string))) +(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)) + (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) ;; Bookmark support -- 2.33.0