]> git.eshelyaron.com Git - emacs.git/commitdiff
Strip "(fn...)" from output of `describe-mode' (bug#38222)
authorJuanma Barranquero <lekktu@gmail.com>
Tue, 19 Nov 2019 10:18:48 +0000 (11:18 +0100)
committerJuanma Barranquero <lekktu@gmail.com>
Tue, 19 Nov 2019 10:18:48 +0000 (11:18 +0100)
* lisp/help.el (help--doc-without-fn): New function.
(describe-mode): Use it.

lisp/help.el

index 3b3d1f977e1482b8333b18e4c0853c686fe2cb38..22f35df1de19baca7d041f4a0a4fc37d9c583ae5 100644 (file)
@@ -878,6 +878,10 @@ current buffer."
             (princ ", which is ")
            (describe-function-1 defn)))))))
 \f
+(defun help--doc-without-fn (mode)
+  ;; Remove the (fn...) thingy at the end of the docstring
+  (replace-regexp-in-string "\n\n(fn[^)]*?)\\'" "" (documentation mode)))
+
 (defun describe-mode (&optional buffer)
   "Display documentation of current major mode and minor modes.
 A brief summary of the minor modes comes first, followed by the
@@ -951,7 +955,7 @@ documentation for the major and minor modes of that buffer."
                                     "no indicator"
                                   (format "indicator%s"
                                           indicator))))
-                 (princ (documentation mode-function)))
+                 (princ (help--doc-without-fn mode-function)))
                (insert-button pretty-minor-mode
                               'action (car help-button-cache)
                               'follow-link t
@@ -981,7 +985,7 @@ documentation for the major and minor modes of that buffer."
                                     nil t)
                (help-xref-button 1 'help-function-def mode file-name)))))
        (princ ":\n")
-       (princ (documentation major-mode)))))
+       (princ (help--doc-without-fn major-mode)))))
   ;; For the sake of IELM and maybe others
   nil)