emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/nadvice bc27bdd 3/9: * nadvice/nadvice.el (advice-add):


From: Stefan Monnier
Subject: [elpa] externals/nadvice bc27bdd 3/9: * nadvice/nadvice.el (advice-add): Add support for :override
Date: Tue, 1 Dec 2020 16:29:04 -0500 (EST)

branch: externals/nadvice
commit bc27bdd8e72793d4a4d27add7abaa5b14634c043
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * nadvice/nadvice.el (advice-add): Add support for :override
---
 nadvice.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/nadvice.el b/nadvice.el
index a7a8f2a..52bb1d4 100644
--- a/nadvice.el
+++ b/nadvice.el
@@ -27,7 +27,7 @@
 ;;
 ;; Limitations;
 ;; - only supports `advice-add' and `advice-remove';
-;; - only handles the :before, :after, and :around kinds of advice;
+;; - 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'.
 ;;
@@ -52,6 +52,8 @@
                 `(progn (apply #',function (ad-get-args 0)) ad-do-it))
                ((eq where :after)
                 `(progn ad-do-it (apply #',function (ad-get-args 0))))
+               ((eq where :override)
+                `(setq ad-return-value (apply #',function (ad-get-args 0))))
                ((eq where :around)
                 `(setq ad-return-value
                        (apply #',function
@@ -59,7 +61,8 @@
                                 (ad-set-args 0 nadvice--rest-arg)
                                 ad-do-it)
                               (ad-get-args 0))))
-               (t (error "This version of nadvice.el only handles :before, 
:after, and :around")))))
+               (t (error "This version of nadvice.el does not handle %S"
+                         where)))))
     (ad-add-advice symbol
                    `(,function nil t (advice lambda () ,body))
                    'around



reply via email to

[Prev in Thread] Current Thread [Next in Thread]