我正在阅读An Introduction to Programming in Emacs Lisp,我看到以下内容:
此代码有效:
(message "The name of this buffer is: %s." (buffer-name))
虽然这个失败了:
(message "The name of this buffer is: %s." buffer-name)
但是,此代码有效:
(message "The value of fill-column is %d." fill-column)
虽然这个失败了:
(message "The value of fill-column is %d." (fill-column))
我的问题是为什么? buffer-name
和fill-column
之间有什么区别?我怎么知道何时使用括号?
答案 0 :(得分:5)
简单地说 - buffer-name
是一个函数(返回一个字符串),fill-column
是一个变量(计算结果为整数)。
所有Lisp方言中的函数调用都应该用括号括起来。
要查看有关Emacs中的功能的详细信息,请按 C-h f函数名称RET 。 要在Emacs中查看有关变量的详细信息,请按 C-h v变量名称RET 。