summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2022-06-07 10:30:47 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2022-06-07 10:31:17 -0400
commita98413726f5a10676f9faf4c4013ac6eaa53b42b (patch)
tree5e8647c4b0dd5e2b47ac710cbb9aba2e8f2553df
parent3864308c20deb69e7b75420377a3b86716215dd3 (diff)
downloademacs-a98413726f5a10676f9faf4c4013ac6eaa53b42b.tar.gz
find-func.el: Fix bug#41104
* lisp/emacs-lisp/find-func.el (find-function-advised-original): Look at the actual function definition rather than `advice--symbol-function` which sometimes returns only the advice. * test/lisp/emacs-lisp/find-func-tests.el (find-func-tests--find-library-verbose): Add test.
-rw-r--r--lisp/emacs-lisp/find-func.el6
-rw-r--r--test/lisp/emacs-lisp/find-func-tests.el7
2 files changed, 10 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index 96eaf1ab642..2dec51dd044 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -270,7 +270,7 @@ If FUNC is not a symbol, return it. Else, if it's not advised,
return the symbol's function definition."
(or (and (symbolp func)
(featurep 'nadvice)
- (let ((ofunc (advice--symbol-function func)))
+ (let ((ofunc (symbol-function func)))
(if (advice--p ofunc)
(advice--cd*r ofunc)
ofunc)))
@@ -516,8 +516,8 @@ Return t if any PRED returns t."
(defun find-function-library (function &optional lisp-only verbose)
"Return the pair (ORIG-FUNCTION . LIBRARY) for FUNCTION.
-ORIG-FUNCTION is the original name, after removing all advice and
-resolving aliases. LIBRARY is an absolute file name, a relative
+ORIG-FUNCTION is the original name, after resolving aliases.
+LIBRARY is an absolute file name, a relative
file name inside the C sources directory, or a name of an
autoloaded feature.
diff --git a/test/lisp/emacs-lisp/find-func-tests.el b/test/lisp/emacs-lisp/find-func-tests.el
index d29d9ff6563..420c61acb55 100644
--- a/test/lisp/emacs-lisp/find-func-tests.el
+++ b/test/lisp/emacs-lisp/find-func-tests.el
@@ -95,6 +95,13 @@ expected function symbol and function library, respectively."
(advice-remove #'mark-sexp 'my-message))
(ert-deftest find-func-tests--find-library-verbose ()
+ (unwind-protect
+ (progn
+ (advice-add 'dired :before #'ignore)
+ ;; bug#41104
+ (should (equal (find-function-library #'dired) '(dired . "dired"))))
+ (advice-remove 'dired #'ignore))
+
(find-function-library #'join-line nil t)
(with-current-buffer "*Messages*"
(save-excursion