I had a look over the weekend, and I cannot see an easy way to check whether a function is advised.
I must be missing something.
HELP! :)
I had a look over the weekend, and I cannot see an easy way to check whether a function is advised.
I must be missing something.
HELP! :)
As lawlist correctly points out in a comment, the Emacs Help system, invoked via C-hfNAME
RET (M-xdescribe-function
RETNAME
RET) in this case, is a quick way to interactively check whether there is any advice currently active on the function named NAME
. This is doubly convenient because the name of the advising function is hyperlinked as a button, allowing you to jump to and back from its definition.
To programmatically determine whether the function definition of a particular symbol (e.g. fn
) contains any advice[1], you can write:
(advice--p (advice--symbol-function 'fn))
Note, however, that the double hyphens indicate this is an internal API and thus subject to breaking change.
[1]: This assumes the new nadvice.el
system in Emacs 24; see (elisp) Porting old advice
.
M-x describe-function
akaC-h f
– lawlist Jan 8 '18 at 17:47advice-add
/advice-remove
updates function's documentation accordingly, thusC-h f
works. From Lisp, take a look atadvice-mapc
andadvice-member-p
. – xuchunyang Jan 8 '18 at 18:15advice-add
) or the old (e.g.,defadvice
). – Drew Jan 8 '18 at 19:16