添加建议时,如何在 elisp 函数的主体中匹配特定表达式?具体来说,在下面的示例中,我想建议使用该函数来find-file-noselect
代替find-file
,即。该行将(find-file path)
生效(find-file-noselect path)
。
(defun tst-fun (path line column)
(find-file path)
(goto-char (point-min))
(forward-line (1- line))
(forward-char column))
;; not sure how to structure this
(defadvice tst-fun (around noselect activate)
(find-file-noselect (ad-get-arg 0))
ad-do-it)
我宁愿把它当作ad-add-function
,但我想先让它工作。