From: Lars Ingebrigtsen Date: Fri, 27 Aug 2021 15:13:00 +0000 (+0200) Subject: Put advice documentation at the end of the displayed doc string X-Git-Tag: emacs-28.0.90~1288 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=61323c6d765a478ffd8c659fe0e805814d9fecb1;p=emacs.git Put advice documentation at the end of the displayed doc string * 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. --- diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el index 4804e859ebe..bb86fa1264e 100644 --- a/lisp/emacs-lisp/nadvice.el +++ b/lisp/emacs-lisp/nadvice.el @@ -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."