summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog15
-rw-r--r--lisp/emacs-lisp/advice.el13
-rw-r--r--test/automated/advice-tests.el6
3 files changed, 25 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4da040d6d5d..5b890a7e0ed 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-07 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * 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 <yamaoka@jpl.org>
* 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 <jay.p.belanger@gmail.com>
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el
index 7917b769ab8..d9d8e4f3b02 100644
--- a/lisp/emacs-lisp/advice.el
+++ b/lisp/emacs-lisp/advice.el
@@ -2917,13 +2917,18 @@ If COMPILE is nil then the result depends on the value of
"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))
diff --git a/test/automated/advice-tests.el b/test/automated/advice-tests.el
index bc9135c92d0..238561bef84 100644
--- a/test/automated/advice-tests.el
+++ b/test/automated/advice-tests.el
@@ -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: