我是 Emacs 的新手,正在尝试编写一些 Emacs Lisp 函数。
我想编写一个带有两个参数并且可以处理交互的函数。但是,其中一个参数是 bool 值 — 如果我可以使用 (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)))
最佳答案
啊,找到了。
(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)))
关于emacs - Elisp:在交互式命令中询问是或否,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4497073/