aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2013-01-07 13:03:01 -0500
committerStefan Monnier2013-01-07 13:03:01 -0500
commit4986fa2175ea41a0ddb051d464293266b3bd7433 (patch)
tree479c51f955a011b6aa023c010f73f25f1ecdfec5
parent3bee311e97e8512ee209853792cc8f4fd5bd0fd5 (diff)
downloademacs-4986fa2175ea41a0ddb051d464293266b3bd7433.tar.gz
emacs-4986fa2175ea41a0ddb051d464293266b3bd7433.zip
* lisp/emacs-lisp/advice.el (ad-activate-advised-definition): Refresh the
advice list when the interactive-spec of ad-Advice-* changes.
-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 @@
12013-01-07 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * emacs-lisp/advice.el (ad-activate-advised-definition): Refresh the
4 advice list when the interactive-spec of ad-Advice-* changes.
5
12013-01-07 Katsumi Yamaoka <yamaoka@jpl.org> 62013-01-07 Katsumi Yamaoka <yamaoka@jpl.org>
2 7
3 * wid-edit.el (widget-default-get): Work for inlined elements. 8 * wid-edit.el (widget-default-get): Work for inlined elements.
@@ -7,7 +12,7 @@
7 12
8 * net/tramp.el (tramp-default-host-alist): New defcustom. 13 * net/tramp.el (tramp-default-host-alist): New defcustom.
9 (tramp-find-host): Use it. 14 (tramp-find-host): Use it.
10 (tramp-eshell-directory-change): Moved from tramp-sh.el. Add to 15 (tramp-eshell-directory-change): Move from tramp-sh.el. Add to
11 `eshell-directory-change-hook'. 16 `eshell-directory-change-hook'.
12 17
13 * net/tramp-adb.el (top): Add adb specific entry in 18 * net/tramp-adb.el (top): Add adb specific entry in
@@ -26,8 +31,8 @@
26 31
27 * net/tramp-adb.el (tramp-adb-ls-toolbox-regexp): The file size can 32 * net/tramp-adb.el (tramp-adb-ls-toolbox-regexp): The file size can
28 consist of more than one digit. 33 consist of more than one digit.
29 (tramp-adb-file-name-handler-alist): Use 34 (tramp-adb-file-name-handler-alist):
30 `tramp-handle-file-exists-p' consistently. 35 Use `tramp-handle-file-exists-p' consistently.
31 (tramp-adb-file-name-handler): Don't tweak `tramp-default-host'. 36 (tramp-adb-file-name-handler): Don't tweak `tramp-default-host'.
32 (tramp-adb-handle-file-exists-p): Remove function. 37 (tramp-adb-handle-file-exists-p): Remove function.
33 (tramp-adb-file-name-host): New defun. 38 (tramp-adb-file-name-host): New defun.
@@ -161,8 +166,8 @@
161 (tramp-do-copy-or-rename-file): Ignore errors when calling 166 (tramp-do-copy-or-rename-file): Ignore errors when calling
162 `set-file-extended-attributes'. 167 `set-file-extended-attributes'.
163 168
164 * net/tramp-smb.el (tramp-smb-file-name-handler-alist): Add 169 * net/tramp-smb.el (tramp-smb-file-name-handler-alist):
165 handler for `file-acl'. 170 Add handler for `file-acl'.
166 (tramp-smb-handle-file-acl): New defun. 171 (tramp-smb-handle-file-acl): New defun.
167 172
1682013-01-02 Jay Belanger <jay.p.belanger@gmail.com> 1732013-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
2917 "Redefine FUNCTION with its advised definition from cache or scratch. 2917 "Redefine FUNCTION with its advised definition from cache or scratch.
2918The resulting FUNCTION will be compiled if `ad-should-compile' returns t. 2918The resulting FUNCTION will be compiled if `ad-should-compile' returns t.
2919The current definition and its cache-id will be put into the cache." 2919The current definition and its cache-id will be put into the cache."
2920 (let ((verified-cached-definition 2920 (let* ((verified-cached-definition
2921 (if (ad-verify-cache-id function) 2921 (if (ad-verify-cache-id function)
2922 (ad-get-cache-definition function))) 2922 (ad-get-cache-definition function)))
2923 (advicefunname (ad-get-advice-info-field function 'advicefunname))) 2923 (advicefunname (ad-get-advice-info-field function 'advicefunname))
2924 (old-ispec (interactive-form advicefunname)))
2924 (fset advicefunname 2925 (fset advicefunname
2925 (or verified-cached-definition 2926 (or verified-cached-definition
2926 (ad-make-advised-definition function))) 2927 (ad-make-advised-definition function)))
2928 (unless (equal (interactive-form advicefunname) old-ispec)
2929 ;; If the interactive-spec of advicefunname has changed, force nadvice to
2930 ;; refresh its copy.
2931 (advice-remove function advicefunname))
2927 (advice-add function :around advicefunname) 2932 (advice-add function :around advicefunname)
2928 (if (ad-should-compile function compile) 2933 (if (ad-should-compile function compile)
2929 (ad-compile-function function)) 2934 (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 @@
107 (lambda (f &rest args) 107 (lambda (f &rest args)
108 (cons (cons 2 (called-interactively-p)) (apply f args)))) 108 (cons (cons 2 (called-interactively-p)) (apply f args))))
109 (should (equal (call-interactively 'sm-test7) '((2 . t) (1 . t) 11))) 109 (should (equal (call-interactively 'sm-test7) '((2 . t) (1 . t) 11)))
110
111 ;; Check handling of interactive spec.
112 (defun sm-test8 (a) (interactive "p") a)
113 (defadvice sm-test8 (before adv1 activate) nil)
114 (defadvice sm-test8 (before adv2 activate) (interactive "P") nil)
115 (should (equal (interactive-form 'sm-test8) '(interactive "P")))
110 )) 116 ))
111 117
112;; Local Variables: 118;; Local Variables: