How can I locate the defadvice for an advised func

2019-05-05 21:38发布

问题:

When I view documentation for beginning-of-defun, there is a note:

This function is advised.

Around-advice `senator':
Move backward to the beginning of a defun.
If semantic tags are available, use them to navigate.

However I can't find in which .el file the defadvice is called. Is there any way to navigate to the original file, where the advice is defined?

Edit: While i marked correct Phils' suggestion to rgrep the .el files, i still hope, that there is some more elegant way to trace back to the defadvice.

回答1:

As far as I know there is no way to navigate to the location of a defadvice expression (I'd be delighted to be proved wrong).

This should presumably track it down:

M-x rgrep RET (defadvice 'beginning-of-defun RET *.el RET ~/.emacs.d/ RET

(or failing that, the site-lisp directory would be the next place to look)

You can also view the advice data structure like this (but this doesn't include the information you're looking for).

(ad-get-advice-info 'beginning-of-defun)