From 83763414fb10ffdb2237edfafbd5e8d228c1162b Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 23 Jul 2019 14:12:01 +0200 Subject: [PATCH] Improve docstring for def-advice! functions Now lists linked functions that the advice was defined with. --- core/core-lib.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/core-lib.el b/core/core-lib.el index cbd77d4d8..8fed37ce4 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -368,11 +368,15 @@ DOCSTRING and BODY are as in `defun'." (push places body) (setq places where where docstring - docstring (format "%s advice for %s." where places))) + docstring nil)) `(progn - (defun ,symbol ,arglist - ,docstring - ,@body) + (fset ',symbol (lambda ,arglist ,@body)) + (put ',symbol 'function-documentation + (format "%sThis is %s advice for the following functions: %s" + ,(if docstring (concat docstring "\n\n") "") + ,where + (mapconcat (lambda (p) (format "`%s'" p)) + (doom-enlist ,places) ", "))) (dolist (target (doom-enlist ,places)) (if (eq ,where :remove) (advice-remove target #',symbol)