emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r111435: * lisp/emacs-lisp/advice.el


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111435: * lisp/emacs-lisp/advice.el (ad-activate-advised-definition): Refresh the
Date: Mon, 07 Jan 2013 13:03:01 -0500
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111435
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2013-01-07 13:03:01 -0500
message:
  * lisp/emacs-lisp/advice.el (ad-activate-advised-definition): Refresh the
  advice list when the interactive-spec of ad-Advice-* changes.
modified:
  lisp/ChangeLog
  lisp/emacs-lisp/advice.el
  test/automated/advice-tests.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-01-07 11:24:35 +0000
+++ b/lisp/ChangeLog    2013-01-07 18:03:01 +0000
@@ -1,3 +1,8 @@
+2013-01-07  Stefan Monnier  <address@hidden>
+
+       * emacs-lisp/advice.el (ad-activate-advised-definition): Refresh the
+       advice list when the interactive-spec of ad-Advice-* changes.
+
 2013-01-07  Katsumi Yamaoka  <address@hidden>
 
        * wid-edit.el (widget-default-get): Work for inlined elements.
@@ -7,7 +12,7 @@
 
        * net/tramp.el (tramp-default-host-alist): New defcustom.
        (tramp-find-host): Use it.
-       (tramp-eshell-directory-change): Moved from tramp-sh.el.  Add to
+       (tramp-eshell-directory-change): Move from tramp-sh.el.  Add to
        `eshell-directory-change-hook'.
 
        * net/tramp-adb.el (top): Add adb specific entry in
@@ -26,8 +31,8 @@
 
        * net/tramp-adb.el (tramp-adb-ls-toolbox-regexp): The file size can
        consist of more than one digit.
-       (tramp-adb-file-name-handler-alist): Use
-       `tramp-handle-file-exists-p' consistently.
+       (tramp-adb-file-name-handler-alist):
+       Use `tramp-handle-file-exists-p' consistently.
        (tramp-adb-file-name-handler): Don't tweak `tramp-default-host'.
        (tramp-adb-handle-file-exists-p): Remove function.
        (tramp-adb-file-name-host): New defun.
@@ -161,8 +166,8 @@
        (tramp-do-copy-or-rename-file): Ignore errors when calling
        `set-file-extended-attributes'.
 
-       * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add
-       handler for `file-acl'.
+       * net/tramp-smb.el (tramp-smb-file-name-handler-alist):
+       Add handler for `file-acl'.
        (tramp-smb-handle-file-acl): New defun.
 
 2013-01-02  Jay Belanger  <address@hidden>

=== modified file 'lisp/emacs-lisp/advice.el'
--- a/lisp/emacs-lisp/advice.el 2013-01-02 16:13:04 +0000
+++ b/lisp/emacs-lisp/advice.el 2013-01-07 18:03:01 +0000
@@ -2917,13 +2917,18 @@
   "Redefine FUNCTION with its advised definition from cache or scratch.
 The resulting FUNCTION will be compiled if `ad-should-compile' returns t.
 The current definition and its cache-id will be put into the cache."
-  (let ((verified-cached-definition
-        (if (ad-verify-cache-id function)
-            (ad-get-cache-definition function)))
-        (advicefunname (ad-get-advice-info-field function 'advicefunname)))
+  (let* ((verified-cached-definition
+          (if (ad-verify-cache-id function)
+              (ad-get-cache-definition function)))
+         (advicefunname (ad-get-advice-info-field function 'advicefunname))
+         (old-ispec (interactive-form advicefunname)))
     (fset advicefunname
           (or verified-cached-definition
               (ad-make-advised-definition function)))
+    (unless (equal (interactive-form advicefunname) old-ispec)
+      ;; If the interactive-spec of advicefunname has changed, force nadvice to
+      ;; refresh its copy.
+      (advice-remove function advicefunname))
     (advice-add function :around advicefunname)
     (if (ad-should-compile function compile)
        (ad-compile-function function))

=== modified file 'test/automated/advice-tests.el'
--- a/test/automated/advice-tests.el    2013-01-02 16:30:50 +0000
+++ b/test/automated/advice-tests.el    2013-01-07 18:03:01 +0000
@@ -107,6 +107,12 @@
                 (lambda (f &rest args)
                   (cons (cons 2 (called-interactively-p)) (apply f args))))
     (should (equal (call-interactively 'sm-test7) '((2 . t) (1 . t) 11)))
+
+    ;; Check handling of interactive spec.
+    (defun sm-test8 (a) (interactive "p") a)
+    (defadvice sm-test8 (before adv1 activate) nil)
+    (defadvice sm-test8 (before adv2 activate) (interactive "P") nil)
+    (should (equal (interactive-form 'sm-test8) '(interactive "P")))
     ))
 
 ;; Local Variables:


reply via email to

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