emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r112295: * lisp/emacs-lisp/nadvice.el


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112295: * lisp/emacs-lisp/nadvice.el: Properly test names when adding advice.
Date: Mon, 15 Apr 2013 11:06:51 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 112295
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14202
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2013-04-15 11:06:51 -0400
message:
  * lisp/emacs-lisp/nadvice.el: Properly test names when adding advice.
  (advice--member-p): New arg `name'.
  (advice--add-function, advice-member-p): Use it.
modified:
  lisp/ChangeLog
  lisp/emacs-lisp/nadvice.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-04-15 14:32:20 +0000
+++ b/lisp/ChangeLog    2013-04-15 15:06:51 +0000
@@ -1,3 +1,9 @@
+2013-04-15  Stefan Monnier  <address@hidden>
+
+       * emacs-lisp/nadvice.el: Properly test names when adding advice.
+       (advice--member-p): New arg `name'.
+       (advice--add-function, advice-member-p): Use it (bug#14202).
+
 2013-04-15  Filipp Gunbin  <address@hidden>
 
        Reformulate java imenu-generic-expression.
@@ -7,7 +13,7 @@
        (cc-imenu-java-type-spec-regexp, cc-imenu-java-comment-regexp)
        (cc-imenu-java-method-arg-regexp): New defconsts.
        (cc-imenu-java-build-type-args-regex): New defun.
-       (cc-imenu-java-generic-expression): Fixed, to remove "ambiguous"
+       (cc-imenu-java-generic-expression): Fix, to remove "ambiguous"
        handling of spaces in the regexp.
 
 2013-03-15  Agustín Martín Domingo  <address@hidden>

=== modified file 'lisp/emacs-lisp/nadvice.el'
--- a/lisp/emacs-lisp/nadvice.el        2013-03-02 07:19:10 +0000
+++ b/lisp/emacs-lisp/nadvice.el        2013-04-15 15:06:51 +0000
@@ -158,11 +158,12 @@
     (advice--make-1 (nth 1 desc) (nth 2 desc)
                     function main props)))
 
-(defun advice--member-p (function definition)
+(defun advice--member-p (function name definition)
   (let ((found nil))
     (while (and (not found) (advice--p definition))
       (if (or (equal function (advice--car definition))
-              (equal function (cdr (assq 'name (advice--props definition)))))
+              (when name
+                (equal name (cdr (assq 'name (advice--props definition))))))
           (setq found t)
         (setq definition (advice--cdr definition))))
     found))
@@ -255,7 +256,8 @@
 
 ;;;###autoload
 (defun advice--add-function (where ref function props)
-  (unless (advice--member-p function (gv-deref ref))
+  (unless (advice--member-p function (cdr (assq 'name props))
+                            (gv-deref ref))
     (setf (gv-deref ref)
           (advice--make where function (gv-deref ref) props))))
 
@@ -396,7 +398,7 @@
   "Return non-nil if ADVICE has been added to FUNCTION-NAME.
 Instead of ADVICE being the actual function, it can also be the `name'
 of the piece of advice."
-  (advice--member-p advice
+  (advice--member-p advice advice
                     (or (get function-name 'advice--pending)
                        (advice--strip-macro
                         (if (fboundp function-name)


reply via email to

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