advice-add :around如何使用原来的interactive并获得参数

(defun foo (a b c)
    (interactive ...I need this...)
    (body ...))
(defun foo_ (fn &rest _)
   ...)
(advice-add #'foo :around #'foo_)

我需要foo当中的交互式部分以及由交互确定的参数a b c,不知道通过advice-add如何实现?

(我知道通过defadvicead-get-arg可以实现这个需求,但是在某些函数中这个方案出现了问题:本应该通过minibuffer多次获取参数的,只有第一个参数获取到了,之后的参数获取都跳过了,before around after都是一样的错误)

(defun foo (a b c)
    (interactive "s\ns\ns"))
(defun foo_ (fn a b c)
   (message (concat a " " b " " c)))
(advice-add 'foo :around #'foo_)
1 个赞

看了下目标函数的实现源码,发现交互部分它写在了body里,怪不得我一直实现不了,还以为是语法问题。大意了…