]> git.eshelyaron.com Git - emacs.git/commitdiff
Make `describe-mode' include a link to the major mode function
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 13 Apr 2022 00:51:03 +0000 (02:51 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 13 Apr 2022 01:50:55 +0000 (03:50 +0200)
* lisp/help-fns.el (describe-mode): Add a link to the mode
function so that the user can go to the manual more easily
(bug#575).

lisp/help-fns.el

index 80d7d5cb028a51bca4b85867bbed372b0c8a2a3e..38b11f1c99fc032a8eab30355af612eec5fd6c31 100644 (file)
@@ -1952,12 +1952,16 @@ documentation for the major and minor modes of that buffer."
 
            (princ "\n(Information about these minor modes follows the major mode info.)\n\n"))
          ;; Document the major mode.
-         (let ((mode mode-name))
-           (with-current-buffer standard-output
-              (let ((start (point)))
-               (insert (format-mode-line mode nil nil buffer))
-               (add-text-properties start (point) '(face bold)))))
-         (princ " mode")
+         (with-current-buffer standard-output
+           (insert (buttonize
+                     (propertize (format-mode-line
+                                  (buffer-local-value 'mode-name buffer)
+                                  nil nil buffer)
+                                 'face 'bold)
+                     (lambda (_)
+                       (describe-function
+                        (buffer-local-value 'major-mode buffer))))))
+          (princ " mode")
          (let* ((mode major-mode)
                 (file-name (find-lisp-object-file-name mode nil)))
            (if (not file-name)