]> git.eshelyaron.com Git - emacs.git/commitdiff
Put advice documentation at the end of the displayed doc string
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 27 Aug 2021 15:13:00 +0000 (17:13 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 27 Aug 2021 15:15:17 +0000 (17:15 +0200)
* lisp/emacs-lisp/nadvice.el (advice--make-docstring): Put the
advice things at the end of the documentation (bug#50222).  It's
important to have the first line of the original documentation
remain the first line, because it's used when doing one-line
summaries of the function.

lisp/emacs-lisp/nadvice.el

index 4804e859ebef7074a7b2f207f728b5c63968bbb9..bb86fa1264e63dfb9b84d2d84045a62b81c4b13a 100644 (file)
@@ -119,7 +119,6 @@ Each element has the form (WHERE BYTECODE STACK) where:
                        (or doc "No documentation")))))
                "\n")))
       (setq flist (advice--cdr flist)))
-    (if docstring (setq docstring (concat docstring "\n")))
     (unless docfun (setq docfun flist))
     (let* ((origdoc (unless (eq function docfun) ;Avoid inf-loops.
                       (documentation docfun t)))
@@ -131,7 +130,12 @@ Each element has the form (WHERE BYTECODE STACK) where:
                         (if (stringp arglist) t
                           (help--make-usage-docstring function arglist)))
                     (setq origdoc (cdr usage)) (car usage)))
-      (help-add-fundoc-usage (concat docstring origdoc) usage))))
+      (help-add-fundoc-usage (concat origdoc
+                                     (if (string-suffix-p "\n" origdoc)
+                                         "\n"
+                                       "\n\n")
+                                     docstring)
+                             usage))))
 
 (defun advice-eval-interactive-spec (spec)
   "Evaluate the interactive spec SPEC."