如果您评估字符串列表,则结果取决于列表项的值。最好的测试方法是启动 ielm repl (Mx 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.