如果您要评估一个字符串列表,结果取决于列表项的值。测试最佳方法是启动ielm repl (M-x ielm),然后输入:
ELISP> '("abc" "def" "ghi")
("abc" "def" "ghi")
引用的字符串列表将被评估为列表值。如果您将列表的值存储在变量中,然后对变量进行评估,则ELisp会抱怨函数
abc未知。
ELISP> (setq my-list '("abc" "def" "ghi"))
("abc" "def" "ghi")
ELISP> (eval my-list)
*** Eval error *** Invalid function: "abc"
对于 yasnippet 目录配置,你只需要设置 yas-snippet-dir 即可,例如:
(add-to-list 'load-path
"~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(setq yas-snippet-dirs
'("~/.emacs.d/snippets" ;; personal snippets
"/path/to/yasnippet/snippets" ;; the default collection
"/path/to/other/snippets" ;; add any other folder with a snippet collection
))
(yas-global-mode 1)
编辑:
使用yas/root-directory已经被弃用。来自yasnippet.el文档的说明。
`yas-snippet-dirs'
The directory where user-created snippets are to be
stored. Can also be a list of directories. In that case,
when used for bulk (re)loading of snippets (at startup or
via `yas-reload-all'), directories appearing earlier in
the list shadow other dir's snippets. Also, the first
directory is taken as the default for storing the user's
new snippets.
The deprecated `yas/root-directory' aliases this variable
for backward-compatibility.