I've noticed that if function f
is used to advise function g
through advice-add
, and function f
is then redefined, function g
's advice is not updated.
After digging into advice-add
a bit, it is clear that advice-add
uses add-function
behind the scenes, which means that it extracts the value in the function cell of f
and uses it to advise g
. Therefore, when f
is redefined, g
is not affected.
I'm wondering why such a design decision was made. Is there a good reason that we shouldn't or couldn't allow updating f
to update g
's advice as well?
f
and get the effect on advicedg
withGNU Emacs 24.4.1
. I have(defun g ()"g")
,(defun f (org-fun &rest args) (concat "f" (apply org-fun args)))
and(advice-add 'g :around #'f)
. Whenever I changef
the effect is visible if I call(g)
. – theldoria Jul 20 '16 at 05:44