all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#19711: 25.0.50; (ad-is-adviced sym) is inconsistent with (advice--p (advice--symbol-function sym))
@ 2015-01-28 13:55 Oleh Krehel
  2015-01-28 19:55 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Oleh Krehel @ 2015-01-28 13:55 UTC (permalink / raw)
  To: 19711


`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))






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#19711: 25.0.50; (ad-is-adviced sym) is inconsistent with (advice--p (advice--symbol-function sym))
  2015-01-28 13:55 bug#19711: 25.0.50; (ad-is-adviced sym) is inconsistent with (advice--p (advice--symbol-function sym)) Oleh Krehel
@ 2015-01-28 19:55 ` Stefan Monnier
  2015-01-28 20:07   ` Oleh Krehel
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2015-01-28 19:55 UTC (permalink / raw)
  To: Oleh Krehel; +Cc: 19711

> `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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#19711: 25.0.50; (ad-is-adviced sym) is inconsistent with (advice--p (advice--symbol-function sym))
  2015-01-28 19:55 ` Stefan Monnier
@ 2015-01-28 20:07   ` Oleh Krehel
  2015-01-28 21:46     ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Oleh Krehel @ 2015-01-28 20:07 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 19711

On Wed, Jan 28, 2015 at 8:55 PM, Stefan Monnier
<monnier@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?





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#19711: 25.0.50; (ad-is-adviced sym) is inconsistent with (advice--p (advice--symbol-function sym))
  2015-01-28 20:07   ` Oleh Krehel
@ 2015-01-28 21:46     ` Stefan Monnier
  2021-08-16 13:15       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2015-01-28 21:46 UTC (permalink / raw)
  To: Oleh Krehel; +Cc: 19711

> 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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#19711: 25.0.50; (ad-is-adviced sym) is inconsistent with (advice--p (advice--symbol-function sym))
  2015-01-28 21:46     ` Stefan Monnier
@ 2021-08-16 13:15       ` Lars Ingebrigtsen
  2021-08-16 17:39         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-16 13:15 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 19711, Oleh Krehel

Stefan Monnier <monnier@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@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





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#19711: 25.0.50; (ad-is-adviced sym) is inconsistent with (advice--p (advice--symbol-function sym))
  2021-08-16 13:15       ` Lars Ingebrigtsen
@ 2021-08-16 17:39         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-08-16 17:39 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 19711-done, Oleh Krehel

> I think this was basically fixed by:
>
> commit 6e2d6d54e1236216462c13655ea1fe573d9672e7
> Author:     Stefan Monnier <monnier@iro.umontreal.ca>
> AuthorDate: Fri Jul 14 11:27:21 2017 -0400

Agreed, closing,


        Stefan






^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-16 17:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-28 13:55 bug#19711: 25.0.50; (ad-is-adviced sym) is inconsistent with (advice--p (advice--symbol-function sym)) Oleh Krehel
2015-01-28 19:55 ` Stefan Monnier
2015-01-28 20:07   ` Oleh Krehel
2015-01-28 21:46     ` Stefan Monnier
2021-08-16 13:15       ` Lars Ingebrigtsen
2021-08-16 17:39         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.