从代码调用命令时如何使用“交互”参数


12

我有一个名为的命令test,该命令只是从用户那里获取输入并回显它:

(defun test (input)
  (interactive "MInput: ")
  (message "%s" input))

我想编写另一个函数来调用它。以下失败:

(defun test-forward ()
  (interactive)
  (test))

这个错误

test-forward: Wrong number of arguments: (lambda (input) (interactive "MInput: ") (message "%s" input)), 0

这是有道理的,因为test需要一个输入。制作testinput &optional只是使test-forward回报nil没有做任何事情。正确的做法是什么?

Answers:


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.