emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master a98413726f: find-func.el: Fix bug#41104


From: Stefan Monnier
Subject: master a98413726f: find-func.el: Fix bug#41104
Date: Tue, 7 Jun 2022 10:31:20 -0400 (EDT)

branch: master
commit a98413726f5a10676f9faf4c4013ac6eaa53b42b
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    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.
---
 lisp/emacs-lisp/find-func.el            | 6 +++---
 test/lisp/emacs-lisp/find-func-tests.el | 7 +++++++
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index 96eaf1ab64..2dec51dd04 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 d29d9ff656..420c61acb5 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]