GNU bug report logs - #19711
25.0.50; (ad-is-adviced sym) is inconsistent with (advice--p (advice--symbol-function sym))

Previous Next

Package: emacs;

Reported by: Oleh Krehel <ohwoeowho <at> gmail.com>

Date: Wed, 28 Jan 2015 13:59:01 UTC

Severity: normal

Tags: moreinfo

Found in version 25.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

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 19711 in the body.
You can then email your comments to 19711 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#19711; Package emacs. (Wed, 28 Jan 2015 13:59:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Oleh Krehel <ohwoeowho <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 28 Jan 2015 13:59:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Oleh Krehel <ohwoeowho <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.50; (ad-is-adviced sym) is inconsistent with (advice--p
 (advice--symbol-function sym))
Date: Wed, 28 Jan 2015 14:55:01 +0100
`ad-is-adviced' expands to:

    (get 'foo 'ad-advice-info)

This code will not detect if the function `foo' is being instrumented
with `elp-instrument-package' (which is a form of advice).

On the other hand, this code from `advice-remove' will work:

    (advice--p (advice--symbol-function 'foo))

To summarize, functions instrumented by elp aren't recognized as adviced
by `ad-is-advised', even though :around advice: even shows up in the
docstring.

A fix could be to change `ad-is-adviced' to expand to either

    (or (get 'foo 'ad-advice-info)
        (get 'foo 'elp-info))

or

    (advice--p (advice--symbol-function 'foo))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19711; Package emacs. (Wed, 28 Jan 2015 19:56:01 GMT) Full text and rfc822 format available.

Message #8 received at 19711 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Oleh Krehel <ohwoeowho <at> gmail.com>
Cc: 19711 <at> debbugs.gnu.org
Subject: Re: bug#19711: 25.0.50;
 (ad-is-adviced sym) is inconsistent with (advice--p
 (advice--symbol-function sym))
Date: Wed, 28 Jan 2015 14:55:19 -0500
> `ad-is-advised' expands to:
>     (get 'foo 'ad-advice-info)
> This code will not detect if the function `foo' is being instrumented
> with `elp-instrument-package' (which is a form of advice).

That's because ad-is-advised tells you "is there a "defadvice" on this
function" rather than "is there some kind of advice-like thingy on this
function".
Since this is used by advice.el internally, changing it might just break
advice.el.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19711; Package emacs. (Wed, 28 Jan 2015 20:08:01 GMT) Full text and rfc822 format available.

Message #11 received at 19711 <at> debbugs.gnu.org (full text, mbox):

From: Oleh Krehel <ohwoeowho <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 19711 <at> debbugs.gnu.org
Subject: Re: bug#19711: 25.0.50; (ad-is-adviced sym) is inconsistent with
 (advice--p (advice--symbol-function sym))
Date: Wed, 28 Jan 2015 21:07:36 +0100
On Wed, Jan 28, 2015 at 8:55 PM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>> `ad-is-advised' expands to:
>>     (get 'foo 'ad-advice-info)
>> This code will not detect if the function `foo' is being instrumented
>> with `elp-instrument-package' (which is a form of advice).
>
> That's because ad-is-advised tells you "is there a "defadvice" on this
> function" rather than "is there some kind of advice-like thingy on this
> function".
> Since this is used by advice.el internally, changing it might just break
> advice.el.

I'm mainly interested in this application:

    (help-function-arglist
     (if (ad-is-advised fun)
         (ad-get-orig-definition fun)
       fun)
     t)

I can't get the original arguments of FUN if it's adviced
(instrumented also falls here), so I'd like to detect if it is.
If `ad-is-advised` isn't enough, what other (public) function could I use?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19711; Package emacs. (Wed, 28 Jan 2015 21:47:01 GMT) Full text and rfc822 format available.

Message #14 received at 19711 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Oleh Krehel <ohwoeowho <at> gmail.com>
Cc: 19711 <at> debbugs.gnu.org
Subject: Re: bug#19711: 25.0.50;
 (ad-is-adviced sym) is inconsistent with (advice--p
 (advice--symbol-function sym))
Date: Wed, 28 Jan 2015 16:46:32 -0500
> I'm mainly interested in this application:

>     (help-function-arglist
>      (if (ad-is-advised fun)
>          (ad-get-orig-definition fun)
>        fun)
>      t)

Ah, I think this is just a bug of help-function-arglist: it should
automatically peel off any advice and look for the arglist of the
unadvised function instead.

> If `ad-is-advised` isn't enough, what other (public) function could I use?

Good question.  I think currently all the functions that could help come
with a "--".


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#19711; Package emacs. (Mon, 16 Aug 2021 13:17:02 GMT) Full text and rfc822 format available.

Message #17 received at 19711 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 19711 <at> debbugs.gnu.org, Oleh Krehel <ohwoeowho <at> gmail.com>
Subject: Re: bug#19711: 25.0.50; (ad-is-adviced sym) is inconsistent with
 (advice--p (advice--symbol-function sym))
Date: Mon, 16 Aug 2021 15:15:44 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> I'm mainly interested in this application:
>
>>     (help-function-arglist
>>      (if (ad-is-advised fun)
>>          (ad-get-orig-definition fun)
>>        fun)
>>      t)
>
> Ah, I think this is just a bug of help-function-arglist: it should
> automatically peel off any advice and look for the arglist of the
> unadvised function instead.

I think this was basically fixed by:

commit 6e2d6d54e1236216462c13655ea1fe573d9672e7
Author:     Stefan Monnier <monnier <at> iro.umontreal.ca>
AuthorDate: Fri Jul 14 11:27:21 2017 -0400

That is, "other advise" (not detected by `ad-is-advised') is now peeled
off by `help-function-arglist' itself, so the code in question should
work as expected, I think.

So I don't think there's anything to fix here (any more).  Is that
correct?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 16 Aug 2021 13:17:03 GMT) Full text and rfc822 format available.

Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Mon, 16 Aug 2021 17:40:02 GMT) Full text and rfc822 format available.

Notification sent to Oleh Krehel <ohwoeowho <at> gmail.com>:
bug acknowledged by developer. (Mon, 16 Aug 2021 17:40:02 GMT) Full text and rfc822 format available.

Message #24 received at 19711-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 19711-done <at> debbugs.gnu.org, Oleh Krehel <ohwoeowho <at> gmail.com>
Subject: Re: bug#19711: 25.0.50; (ad-is-adviced sym) is inconsistent with
 (advice--p (advice--symbol-function sym))
Date: Mon, 16 Aug 2021 13:39:31 -0400
> I think this was basically fixed by:
>
> commit 6e2d6d54e1236216462c13655ea1fe573d9672e7
> Author:     Stefan Monnier <monnier <at> iro.umontreal.ca>
> AuthorDate: Fri Jul 14 11:27:21 2017 -0400

Agreed, closing,


        Stefan





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 14 Sep 2021 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 290 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.