Improve docstring for def-advice! functions

Now lists linked functions that the advice was defined with.
This commit is contained in:
Henrik Lissner 2019-07-23 14:12:01 +02:00
parent 76cacb5bfe
commit 83763414fb
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -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)