GNU bug report logs -
#20718
25.0.50; find-function fails on advised subrs (again)
Previous Next
Reported by: michael_heerdegen <at> web.de
Date: Tue, 2 Jun 2015 12:50:03 UTC
Severity: normal
Found in version 25.0.50
Fixed in version 25.1
Done: Dmitry Gutov <dgutov <at> yandex.ru>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20718 in the body.
You can then email your comments to 20718 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20718
; Package
emacs
.
(Tue, 02 Jun 2015 12:50:04 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
michael_heerdegen <at> web.de
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 02 Jun 2015 12:50:05 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello,
just as a random example:
(advice-add 'handle-switch-frame :after #'prin1)
and M-x find-function 'handle-switch-frame RET
==> find-function-search-for-symbol: Don't know where
`handle-switch-frame' is defined
Works without advicing. I included the word "again" in the subject
because this had been fixed once in #789 in 2008.
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.
Thanks,
Michael.
In GNU Emacs 25.0.50.4 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.5)
of 2015-05-30 on drachen
Windowing system distributor `The X.Org Foundation', version 11.0.11701000
System Description: Debian GNU/Linux testing (stretch)
Added indication that bug 20718 blocks19759
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Tue, 02 Jun 2015 15:30:05 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20718
; Package
emacs
.
(Thu, 04 Jun 2015 00:11:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 20718 <at> debbugs.gnu.org (full text, mbox):
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))))
func))
(defun find-function-C-source (fun-or-var file type)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#20718
; Package
emacs
.
(Thu, 04 Jun 2015 16:25:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 20718 <at> debbugs.gnu.org (full text, mbox):
> 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).
Indeed, even its docstring says that it returns "the original function
symbol", and that's basically meaningless in general (and in the
nadvice case in particular).
So the callers will need to be adjusted.
Stefan
> 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))))
> func))
> (defun find-function-C-source (fun-or-var file type)
Reply sent
to
Dmitry Gutov <dgutov <at> yandex.ru>
:
You have taken responsibility.
(Thu, 04 Jun 2015 22:38:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
michael_heerdegen <at> web.de
:
bug acknowledged by developer.
(Thu, 04 Jun 2015 22:38:03 GMT)
Full text and
rfc822 format available.
Message #18 received at 20718-done <at> debbugs.gnu.org (full text, mbox):
Version: 25.1
On 06/04/2015 06:55 PM, Stefan Monnier wrote:
> So the callers will need to be adjusted.
Ok, done. I seems to work now.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 03 Jul 2015 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 years and 352 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.