summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/nadvice.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2013-01-15 01:05:22 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2013-01-15 01:05:22 -0500
commitcb9c0a53bc4a6d67f10d4674472b2884a71852c8 (patch)
treebf43c694ff8de8bc246c19bdc929a336e3dd969b /lisp/emacs-lisp/nadvice.el
parentef8214345ba7b46de9837fbe9461e19f18e6d660 (diff)
downloademacs-cb9c0a53bc4a6d67f10d4674472b2884a71852c8.tar.gz
* lisp/emacs-lisp/advice.el (ad-preactivate-advice): Adjust the cleanup to
the use of nadvice.el. * lisp/emacs-lisp/nadvice.el (advice--tweak): Make it possible for `tweak' to return an explicit nil. (advice--remove-function): Change accordingly. * test/automated/advice-tests.el: Split up. Add advice-test-preactivate.
Diffstat (limited to 'lisp/emacs-lisp/nadvice.el')
-rw-r--r--lisp/emacs-lisp/nadvice.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el
index 1715763d482..b0711fed26c 100644
--- a/lisp/emacs-lisp/nadvice.el
+++ b/lisp/emacs-lisp/nadvice.el
@@ -173,20 +173,21 @@ WHERE is a symbol to select an entry in `advice--where-alist'."
(let ((first (advice--car flist))
(rest (advice--cdr flist))
(props (advice--props flist)))
- (or (funcall tweaker first rest props)
+ (let ((val (funcall tweaker first rest props)))
+ (if val (car val)
(let ((nrest (advice--tweak rest tweaker)))
(if (eq rest nrest) flist
(advice--make-1 (aref flist 1) (aref flist 3)
- first nrest props)))))))
+ first nrest props))))))))
;;;###autoload
(defun advice--remove-function (flist function)
(advice--tweak flist
(lambda (first rest props)
- (if (or (not first)
- (equal function first)
+ (cond ((not first) rest)
+ ((or (equal function first)
(equal function (cdr (assq 'name props))))
- rest))))
+ (list rest))))))
(defvar advice--buffer-local-function-sample nil)