emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 49192e9: Strip "(fn...)" from output of `describe-mode' (bug#3822


From: Juanma Barranquero
Subject: master 49192e9: Strip "(fn...)" from output of `describe-mode' (bug#38222)
Date: Tue, 19 Nov 2019 05:19:31 -0500 (EST)

branch: master
commit 49192e9510fe3c491b8c759a639bbe8bccf35856
Author: Juanma Barranquero <address@hidden>
Commit: Juanma Barranquero <address@hidden>

    Strip "(fn...)" from output of `describe-mode' (bug#38222)
    
    * lisp/help.el (help--doc-without-fn): New function.
    (describe-mode): Use it.
---
 lisp/help.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/help.el b/lisp/help.el
index 3b3d1f9..22f35df 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -878,6 +878,10 @@ current buffer."
             (princ ", which is ")
            (describe-function-1 defn)))))))
 
+(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)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]