>From 58f8a59c9e93f081f76f8cf773d78be3b7d3740b Mon Sep 17 00:00:00 2001 From: Arthur Miller Date: Fri, 24 Sep 2021 21:54:31 +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 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 551cf7e1a3..94fce1e8ec 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -875,6 +875,21 @@ help-insert-string (with-output-to-temp-buffer (help-buffer) (insert string))) +(defun help-do-command () + "Execute a command in \"*Help*\" buffer while working in other buffer. + +If *Help* buffer is not visible, the HELP-DO-COMMAND will be aborted." + (interactive) + (if (get-buffer-window (help-buffer)) + (progn + (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