diff options
author | Glenn Morris <rgm@gnu.org> | 2014-05-25 19:28:09 -0700 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2014-05-25 19:28:09 -0700 |
commit | 015936fba1bcaa51b7886a73144d4c088200c0aa (patch) | |
tree | c9628339352c1a97e574df28966e977143c43e41 /lisp/emacs-lisp/nadvice.el | |
parent | 5e26d9849a79bf78fda821979fc937f7e5e6df52 (diff) | |
parent | e8f2cc26e712f42f6391fa52cd67c3e791096f1e (diff) | |
download | emacs-015936fba1bcaa51b7886a73144d4c088200c0aa.tar.gz |
Merge from emacs-24; up to 2014-05-26T10:21:18Z!rgm@gnu.org
Diffstat (limited to 'lisp/emacs-lisp/nadvice.el')
-rw-r--r-- | lisp/emacs-lisp/nadvice.el | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el index 66a4f8fdea7..bfd939d69e2 100644 --- a/lisp/emacs-lisp/nadvice.el +++ b/lisp/emacs-lisp/nadvice.el @@ -180,12 +180,16 @@ WHERE is a symbol to select an entry in `advice--where-alist'." (advice--make-1 (nth 1 desc) (nth 2 desc) function main props))))) -(defun advice--member-p (function name definition) +(defun advice--member-p (function use-name definition) (let ((found nil)) (while (and (not found) (advice--p definition)) - (if (if name - (equal name (cdr (assq 'name (advice--props definition)))) - (equal function (advice--car definition))) + (if (if (eq use-name :use-both) + (or (equal function + (cdr (assq 'name (advice--props definition)))) + (equal function (advice--car definition))) + (equal function (if use-name + (cdr (assq 'name (advice--props definition))) + (advice--car definition)))) (setq found definition) (setq definition (advice--cdr definition)))) found)) @@ -292,7 +296,7 @@ is also interactive. There are 3 cases: ;;;###autoload (defun advice--add-function (where ref function props) (let* ((name (cdr (assq 'name props))) - (a (advice--member-p function name (gv-deref ref)))) + (a (advice--member-p (or name function) (if name t) (gv-deref ref)))) (when a ;; The advice is already present. Remove the old one, first. (setf (gv-deref ref) @@ -324,7 +328,7 @@ properties alist that was specified when it was added." "Return non-nil if ADVICE is already in FUNCTION-DEF. Instead of ADVICE being the actual function, it can also be the `name' of the piece of advice." - (advice--member-p advice advice function-def)) + (advice--member-p advice :use-both function-def)) ;;;; Specific application of add-function to `symbol-function' for advice. |