diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2013-01-07 13:03:01 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2013-01-07 13:03:01 -0500 |
commit | 4986fa2175ea41a0ddb051d464293266b3bd7433 (patch) | |
tree | 479c51f955a011b6aa023c010f73f25f1ecdfec5 /lisp/emacs-lisp/advice.el | |
parent | 3bee311e97e8512ee209853792cc8f4fd5bd0fd5 (diff) | |
download | emacs-4986fa2175ea41a0ddb051d464293266b3bd7433.tar.gz |
* lisp/emacs-lisp/advice.el (ad-activate-advised-definition): Refresh the
advice list when the interactive-spec of ad-Advice-* changes.
Diffstat (limited to 'lisp/emacs-lisp/advice.el')
-rw-r--r-- | lisp/emacs-lisp/advice.el | 13 |
1 files changed, 9 insertions, 4 deletions
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)) |