From 4986fa2175ea41a0ddb051d464293266b3bd7433 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 7 Jan 2013 13:03:01 -0500 Subject: * lisp/emacs-lisp/advice.el (ad-activate-advised-definition): Refresh the advice list when the interactive-spec of ad-Advice-* changes. --- lisp/emacs-lisp/advice.el | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lisp/emacs-lisp') 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)) -- cgit v1.2.3