【发布时间】:2010-02-07 00:10:52
【问题描述】:
如何指定具有可选数字前缀的函数,如果没有,它会提示输入数字?基本上 goto-line 的行为如何?
(defun my-function(&optional n)
; I have tried
(interactive "N") ; reads string, no prompt
(interactive "p") ; defaults to one
(interactive (if (not n) (read-number "N: "))) ; runtime error
那么我该如何工作呢? 谢谢
【问题讨论】:
-
FWIW,如果要提示“N”,只需在 N 后面添加提示文本即可;
(interactive "NType a number: ").
标签: emacs lisp prefix optional