[Top][All Lists]

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

bug#20718: 25.0.50; find-function fails on advised subrs (again)

From: Dmitry Gutov
Subject: bug#20718: 25.0.50; find-function fails on advised subrs (again)
Date: Thu, 4 Jun 2015 03:09:55 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0

On 06/02/2015 03:49 PM, Michael Heerdegen wrote:

It doesn't work because `find-function-library' performs the subrp test
just on the symbol function of the given function name, which is the
advice, not the original subr.

At a glance, the problem is in find-function-advised-original: it only supports the old-style advice, and returns nil for 'handle-switch-frame augmented with advice-add.

Something like the patch below should fix it, but then the function returns a #<subr> object, instead of function symbol, and several callers seem to depend on the return value being the latter (because they want to call symbol-function on it).

diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index 7ea13d4..75fdfc7 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -192,9 +192,9 @@ defined in C.")
   "Return the original function symbol of an advised function FUNC.
 If FUNC is not the symbol of an advised function, just returns FUNC."
   (or (and (symbolp func)
-          (featurep 'advice)
-          (let ((ofunc (cdr (assq 'origname (ad-get-advice-info func)))))
-            (and (fboundp ofunc) ofunc)))
+          (featurep 'nadvice)
+          (let ((ofunc (advice--symbol-function func)))
+            (and (advice--p ofunc) (advice--cd*r ofunc))))

 (defun find-function-C-source (fun-or-var file type)

reply via email to

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