0

我在第一个练习部分(Emacs Lisp Intro),但我没有得到它;3.12 练习:

编写一个函数来测试 `fill-column' 的当前值是否大于传递给函数的参数,如果是,则打印适当的消息。

我有:

(defun is-fill-equal (number)
   "Is fill-column greater than the argument passed to the function."
   (interactive "p")
(if (= fill-column number)
    (message "They are equal.")
  (message "They are not equal."))

无论我尝试什么,我都会收到此错误:

调试器进入--Lisp 错误: (void-variable number)

4

1 回答 1

3

你最后少了一个括号。尝试:

(defun is-fill-equal (number)
   "Is fill-column greater than the argument passed to the function."
   (interactive "p")
   (if (= fill-column number)
       (message "They are equal.")
     (message "They are not equal.")))

错误消息的原因是您可能C-x e在函数定义的末尾。由于您缺少一个括号,Emacs 认为您要评估的表达式在该上下文中是(if (= fill-column number) ...)并且未绑定。number

于 2013-02-04T15:55:18.093 回答