Elisp:在交互式命令中询问是或否

a p*_*erd 6 lisp emacs elisp

我是Emacs的新手,我正在尝试编写一些Emacs Lisp函数.

我想编写一个带有两个参数的函数,可以处理交互.但是,其中一个参数是布尔值 - 如果我可以使用它会很完美(y-or-no-p),但(interactive)似乎没有字符代码.

有任何想法吗?

更新:我正在使用GNU Emacs 23.

此外,这是我的功能到目前为止的样子:

(defun foo (str bool)
  (interactive "sSome text: \nsDo the thing?")
  (some-func str)
  (if bool (some-other-func str)))
Run Code Online (Sandbox Code Playgroud)

a p*_*erd 10

啊,找到了.

(defun foo (str bool)
  (interactive
    (list (read-string "Some text: ")
          (y-or-n-p "Do the thing? ")))
  (some-func str)
  (if bool (some-other-func str)))
Run Code Online (Sandbox Code Playgroud)