Elisp的帮助。为什么以下代码段失败?

时间:2012-08-13 06:51:48

标签: emacs elisp

我正在尝试写一个小脚本,当有人在erc中与我交谈时通知我。所以我需要编写一个函数来接收我认为是两个字符串,缺口和消息的东西,所以我可以把它挂钩。但我的测试功能失败了。我已经测试了growl-notify和格式s-expresions并且它们工作正常,但我无法通过测试来工作。我不知道它为什么会失败。有什么指针吗?

(defun growl-notify (&key message)
  "Use growl for notifications"
  (start-process "growlnotify" "growlnotifications" "growlnotify" "-m " message))

(defun test (nick msg)
  (growlnotify :message (format "%s: %s" nick msg)))

(test "Ppop" "something")

它提供了以下回溯,希望它有所帮助。

Debugger entered--Lisp error: (void-function growlnotify)
  (growlnotify :message (format "%s: %s" nick msg))
  test("oi" "poi")
  eval((test "oi" "poi") nil)
  eval-last-sexp-1(t)
  eval-last-sexp(t)
  eval-print-last-sexp()
  call-interactively(eval-print-last-sexp nil nil)
  recursive-edit()
  debug(error (wrong-number-of-arguments (lambda (&key message) "Use growl for notifications" (start-process "growlnotify" "growlnotifications" "growlnotify" "-m " message)) 3))

1 个答案:

答案 0 :(得分:1)

错误消息为Debugger entered--Lisp error: (void-function growlnotify),它告诉您growlnotify未定义为函数。

如果您查看代码,您会看到您将其定义为:(defun growl-notify (&key message),它定义了一个名为growl-notify的函数。一个简单的错字。