diff options
| author | Dmitry Gutov | 2015-06-05 01:34:40 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2015-06-05 01:34:40 +0300 |
| commit | f6fc446d93d0c3d19aad779fd093d8408a6e3c31 (patch) | |
| tree | 293af1d6924c7ee4723ac63e6a59918f5e474a4a | |
| parent | d4aca72ead4c1e53819e6e3249e26400a9879a0e (diff) | |
| download | emacs-f6fc446d93d0c3d19aad779fd093d8408a6e3c31.tar.gz emacs-f6fc446d93d0c3d19aad779fd093d8408a6e3c31.zip | |
Handle new-style advice in find-funct
* lisp/emacs-lisp/find-func.el (find-function-advised-original):
Handle new-style advice. Return the symbol's function definition.
(Bug#20718)
(find-function-library): Update accordingly.
| -rw-r--r-- | lisp/emacs-lisp/find-func.el | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 7ea13d4637b..54f8340862d 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el | |||
| @@ -189,12 +189,15 @@ defined in C.") | |||
| 189 | (declare-function ad-get-advice-info "advice" (function)) | 189 | (declare-function ad-get-advice-info "advice" (function)) |
| 190 | 190 | ||
| 191 | (defun find-function-advised-original (func) | 191 | (defun find-function-advised-original (func) |
| 192 | "Return the original function symbol of an advised function FUNC. | 192 | "Return the original function definition of an advised function FUNC. |
| 193 | If FUNC is not the symbol of an advised function, just returns FUNC." | 193 | If FUNC is not a symbol, return it. Else, if it's not advised, |
| 194 | return the symbol's function definition." | ||
| 194 | (or (and (symbolp func) | 195 | (or (and (symbolp func) |
| 195 | (featurep 'advice) | 196 | (featurep 'nadvice) |
| 196 | (let ((ofunc (cdr (assq 'origname (ad-get-advice-info func))))) | 197 | (let ((ofunc (advice--symbol-function func))) |
| 197 | (and (fboundp ofunc) ofunc))) | 198 | (if (advice--p ofunc) |
| 199 | (advice--cd*r ofunc) | ||
| 200 | ofunc))) | ||
| 198 | func)) | 201 | func)) |
| 199 | 202 | ||
| 200 | (defun find-function-C-source (fun-or-var file type) | 203 | (defun find-function-C-source (fun-or-var file type) |
| @@ -331,7 +334,7 @@ signal an error. | |||
| 331 | If VERBOSE is non-nil, and FUNCTION is an alias, display a | 334 | If VERBOSE is non-nil, and FUNCTION is an alias, display a |
| 332 | message about the whole chain of aliases." | 335 | message about the whole chain of aliases." |
| 333 | (let ((def (if (symbolp function) | 336 | (let ((def (if (symbolp function) |
| 334 | (symbol-function (find-function-advised-original function)))) | 337 | (find-function-advised-original function))) |
| 335 | aliases) | 338 | aliases) |
| 336 | ;; FIXME for completeness, it might be nice to print something like: | 339 | ;; FIXME for completeness, it might be nice to print something like: |
| 337 | ;; foo (which is advised), which is an alias for bar (which is advised). | 340 | ;; foo (which is advised), which is an alias for bar (which is advised). |
| @@ -344,8 +347,8 @@ message about the whole chain of aliases." | |||
| 344 | (symbol-name def))) | 347 | (symbol-name def))) |
| 345 | (format "`%s' is an alias for `%s'" | 348 | (format "`%s' is an alias for `%s'" |
| 346 | function (symbol-name def))))) | 349 | function (symbol-name def))))) |
| 347 | (setq function (symbol-function (find-function-advised-original function)) | 350 | (setq function (find-function-advised-original function) |
| 348 | def (symbol-function (find-function-advised-original function)))) | 351 | def (find-function-advised-original function))) |
| 349 | (if aliases | 352 | (if aliases |
| 350 | (message "%s" aliases)) | 353 | (message "%s" aliases)) |
| 351 | (cons function | 354 | (cons function |