[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/nadvice 1bfa920 7/9: * nadvice/nadvice.el: Silence fewe
From: |
Stefan Monnier |
Subject: |
[elpa] externals/nadvice 1bfa920 7/9: * nadvice/nadvice.el: Silence fewer errors |
Date: |
Tue, 1 Dec 2020 16:29:05 -0500 (EST) |
branch: externals/nadvice
commit 1bfa9201a8e3a13bb897e0d90c56ae40dd46d3b4
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
* nadvice/nadvice.el: Silence fewer errors
(advice-member-p): New function.
(advice-remove): Use it.
---
nadvice.el | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/nadvice.el b/nadvice.el
index b4eec86..447132c 100644
--- a/nadvice.el
+++ b/nadvice.el
@@ -26,7 +26,7 @@
;; move to the new advice system without dropping support for Emacs<24.4.
;;
;; Limitations;
-;; - only supports `advice-add' and `advice-remove';
+;; - only supports `advice-add', `advice-remove', and `advice-member-p'.
;; - only handles the :before, :after, :override, and :around kinds of advice;
;; - requires a named rather than anonymous function;
;; - and does not support any additional properties like `name' or `depth'.
@@ -47,6 +47,9 @@
;; since ad-remove-advice is not autoloaded.
(require 'advice)
+(defun advice-member-p (advice symbol)
+ (ad-find-advice symbol 'around advice))
+
;;;###autoload
(defun advice-add (symbol where function &optional props)
(when props
@@ -79,12 +82,9 @@
(defun advice-remove (symbol function)
;; 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)))
+ (when (advice-member-p function symbol)
+ (ad-remove-advice symbol 'around function)
+ (ad-activate symbol)))
)
- [elpa] branch externals/nadvice created (now 2114e1c), Stefan Monnier, 2020/12/01
- [elpa] externals/nadvice cc671ee 4/9: * nadvice.el: Fix typo, Stefan Monnier, 2020/12/01
- [elpa] externals/nadvice 6d4e090 6/9: packages/nadvice: Fix advice-remove behaviour, Stefan Monnier, 2020/12/01
- [elpa] externals/nadvice 2114e1c 9/9: * .gitignore: New file, Stefan Monnier, 2020/12/01
- [elpa] externals/nadvice 2b0e882 1/9: * nadvice: New forward compatibility package, Stefan Monnier, 2020/12/01
- [elpa] externals/nadvice 7233212 2/9: * nadvice.el: Fix copyright!, Stefan Monnier, 2020/12/01
- [elpa] externals/nadvice bc27bdd 3/9: * nadvice/nadvice.el (advice-add): Add support for :override, Stefan Monnier, 2020/12/01
- [elpa] externals/nadvice 040b27d 5/9: * nadvice.el: ad-remove-advice is not autoloaded, Stefan Monnier, 2020/12/01
- [elpa] externals/nadvice 1bfa920 7/9: * nadvice/nadvice.el: Silence fewer errors,
Stefan Monnier <=
- [elpa] externals/nadvice 184fdad 8/9: * nadvice/nadvice.el (advice): Require during byte-compilation, Stefan Monnier, 2020/12/01