Add 'help-find-source' and bind it to C-h 4 s
authorAndrea Corallo <acorallo@gnu.org>
Tue, 28 May 2024 19:06:21 +0000 (21:06 +0200)
committerAndrea Corallo <acorallo@gnu.org>
Wed, 29 May 2024 14:34:51 +0000 (16:34 +0200)
* lisp/help-fns.el (help-find-source): New function.
* lisp/help.el (help-map): Bind 'help-find-source' to C-h z.
(help-for-help): Add 'help-find-source'.

lisp/help-fns.el
lisp/help.el

index f2257cb93986975179ad8216ed6e7de3ba341d0f..1ffe1b1658890c2b71eef43ab127a6fa2801feab 100644 (file)
@@ -298,6 +298,15 @@ handling of autoloaded functions."
           ;; Return the text we displayed.
           (buffer-string))))))
 
+;;;###autoload
+(defun help-find-source ()
+  "Switch to a buffer visiting the source of what is being described in *Help*."
+  (interactive)
+  (if-let ((help-buffer (get-buffer "*Help*")))
+      (with-current-buffer help-buffer
+          (help-view-source))
+    (error "No *Help* buffer found")))
+
 ;;;###autoload
 (defun describe-command (command)
   "Display the full documentation of COMMAND (a symbol).
index 616a45328fd75bd8b8b7e05f9e6d47a7cc988a53..2feb178ff6c1df5fbc176b808d26ee9414e955ab 100644 (file)
@@ -114,6 +114,7 @@ buffer.")
   "R"    #'info-display-manual
   "s"    #'describe-syntax
   "t"    #'help-with-tutorial
+  "4 s"  #'help-find-source
   "v"    #'describe-variable
   "w"    #'where-is
   "x"    #'describe-command
@@ -418,6 +419,7 @@ Do not call this in the scope of `with-help-window'."
         "Search documentation of functions, variables, and other items")
        ("describe-command" "Show help for command")
        ("describe-function" "Show help for function")
+       ("help-find-source" "Show the source for what's being described in *Help*")
        ("describe-variable" "Show help for variable")
        ("describe-symbol" "Show help for function or variable"))
       ("Manuals"