all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: [elpa] master 61ad720: packages/nadvice: Fix advice-remove behaviour
       [not found] ` <20180915233624.2285320442@vcs0.savannah.gnu.org>
@ 2018-09-17 13:54   ` Stefan Monnier
  2018-09-17 14:12     ` Michael Albinus
  2018-09-17 15:06   ` Stefan Monnier
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2018-09-17 13:54 UTC (permalink / raw)
  To: emacs-devel; +Cc: Thomas Fitzsimmons

>  ;;;###autoload
>  (defun advice-remove (symbol function)
> -  (ad-remove-advice symbol 'around function)
> -  (ad-activate symbol))
> +  ;; Just return nil if there is no advice, rather than signaling an
> +  ;; error.
> +  (condition-case nil
> +      (ad-remove-advice symbol 'around function)
> +    (error nil))
> +  (condition-case nil
> +      (ad-activate symbol)
> +    (error nil)))

Thanks, looks good'nuf


        Stefan



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

* Re: [elpa] master 61ad720: packages/nadvice: Fix advice-remove behaviour
  2018-09-17 13:54   ` [elpa] master 61ad720: packages/nadvice: Fix advice-remove behaviour Stefan Monnier
@ 2018-09-17 14:12     ` Michael Albinus
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Albinus @ 2018-09-17 14:12 UTC (permalink / raw)
  To: Thomas Fitzsimmons; +Cc: emacs-devel

>  ;;;###autoload
>  (defun advice-remove (symbol function)
> -  (ad-remove-advice symbol 'around function)
> -  (ad-activate symbol))
> +  ;; Just return nil if there is no advice, rather than signaling an
> +  ;; error.
> +  (condition-case nil
> +      (ad-remove-advice symbol 'around function)
> +    (error nil))
> +  (condition-case nil
> +      (ad-activate symbol)
> +    (error nil)))

I would write

(ignore-errors (ad-remove-advice symbol 'around function))
(ignore-errors (ad-activate symbol))

Best regards, Michael.



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

* Re: [elpa] master 61ad720: packages/nadvice: Fix advice-remove behaviour
       [not found] ` <20180915233624.2285320442@vcs0.savannah.gnu.org>
  2018-09-17 13:54   ` [elpa] master 61ad720: packages/nadvice: Fix advice-remove behaviour Stefan Monnier
@ 2018-09-17 15:06   ` Stefan Monnier
  2018-09-18  0:29     ` Thomas Fitzsimmons
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2018-09-17 15:06 UTC (permalink / raw)
  To: emacs-devel; +Cc: Thomas Fitzsimmons

> +  ;; Just return nil if there is no advice, rather than signaling an
> +  ;; error.
> +  (condition-case nil
> +      (ad-remove-advice symbol 'around function)
> +    (error nil))
> +  (condition-case nil
> +      (ad-activate symbol)
> +    (error nil)))

BTW, I just pushed a change which adds support for advice-member-p and
changes the above code to make use of it, in order to silence
fewer errors.

It works in my tests, but could you check that it still works for you?


        Stefan



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

* Re: [elpa] master 61ad720: packages/nadvice: Fix advice-remove behaviour
  2018-09-17 15:06   ` Stefan Monnier
@ 2018-09-18  0:29     ` Thomas Fitzsimmons
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Fitzsimmons @ 2018-09-18  0:29 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> +  ;; Just return nil if there is no advice, rather than signaling an
>> +  ;; error.
>> +  (condition-case nil
>> +      (ad-remove-advice symbol 'around function)
>> +    (error nil))
>> +  (condition-case nil
>> +      (ad-activate symbol)
>> +    (error nil)))
>
> BTW, I just pushed a change which adds support for advice-member-p and
> changes the above code to make use of it, in order to silence
> fewer errors.
>
> It works in my tests, but could you check that it still works for you?

Confirmed still working, thanks.

Thomas



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

end of thread, other threads:[~2018-09-18  0:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20180915233623.2746.56778@vcs0.savannah.gnu.org>
     [not found] ` <20180915233624.2285320442@vcs0.savannah.gnu.org>
2018-09-17 13:54   ` [elpa] master 61ad720: packages/nadvice: Fix advice-remove behaviour Stefan Monnier
2018-09-17 14:12     ` Michael Albinus
2018-09-17 15:06   ` Stefan Monnier
2018-09-18  0:29     ` Thomas Fitzsimmons

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.