如题。advice.el中有ad-deactivate,ad-disable-advice等,但nadvice.el就没有相似函数,试了ad-deactivate不能临时禁用。
1 个赞
方法一:
(unwind-protect
(progn
(advice-remove 'foo #'foo-advice)
(foo ...))
(advice-add 'foo :<WHERE> #'foo-advice))
方法二:
(if-let ((orig-fn
(and (advice--p (symbol-function 'foo))
(advice--cdr (symbol-function 'foo)))))
(funcall orig-fn ...))
2 个赞
多谢,不知方法一开销怎么样?似乎方法二好