2
我通過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
有什麼不同?我如何知道何時使用括號?
謝謝。這很有道理。有沒有一種方法可以交互地知道給定的符號是函數,變量還是其他的? (即使用'C-x C-e'或任何等效命令) –
我建議在交互式shell中使用'M-x ielm'來試驗Emacs Lisp。 –
user273158:請注意,elisp符號同時具有一個值槽和一個功能槽,這意味着給定的符號可以(可能)用作變量和函數。交互式地,'C-h v'顯示幫助變量和'C-h f'幫助一個函數。非交互式地,函數'boundp'和'fboundp'告訴你是否填充給定符號的值和函數時隙。 – phils