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

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

[elpa] master 39be64a: * nadvice/nadvice.el (advice-add): Add support fo


From: Stefan Monnier
Subject: [elpa] master 39be64a: * nadvice/nadvice.el (advice-add): Add support for :override
Date: Wed, 12 Sep 2018 15:40:57 -0400 (EDT)

branch: master
commit 39be64a8c23ed5c5032b37f5c4dd33e7e2c6c436
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

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

diff --git a/packages/nadvice/nadvice.el b/packages/nadvice/nadvice.el
index a7a8f2a..52bb1d4 100644
--- a/packages/nadvice/nadvice.el
+++ b/packages/nadvice/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]