我想根据第一个问题的答案向用户提出第二个问题。
(defun something (a b)
(interactive
(list
(read-number "First num: ")
(read-number "Second num: ")))
(message "a is %s and b is %s" a b))
所以我需要一种方法来测试条目值:
(defun something-else (a &optional b)
(interactive
(list
(read-number "First num: ")
(if (< a 2)
(read-number "Second num: "))))
(message "a is %s" a))
但是
if: Symbol's value as variable is void: a
问题:我怎样才能以真正互动的方式使用 interactive
?
最佳答案
(defun xtest (a &optional b)
(interactive
(let (a b)
(setq a (read-number "First: "))
(if (< a 2)
(setq b (read-number "Second: ")))
(list a b)))
(message "a is %s b is %s" a b))
关于elisp - Emacs Lisp : How to use interactive (for conditional arguments)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25447312/