我有一个插件系统设置,它将(在编译时)搜索插件目录中的所有插件。
我的问题是我试图允许 Flycheck 将这些插件的 header 添加到包含路径中。
我遇到的问题是我无法弄清楚如何使表达式实际计算其值。 (表达式被视为一个值而不是被计算)
((c++-mode . ((flycheck-clang-include-path . (split-string (substring
(shell-command-to-string
(concat "echo src;"
"cd /home/czipperz/vick &&"
"[ \"$(ls plugins)\" ] &&"
"[ \"$(find plugins -name src -type d)\" ] &&"
" find plugins -name src -type d")) 0 -1)
"\n+")))))
当我打开文件时,出现错误:自动检查语法时出错:(split-string (substring ...) "\n+") of Flycheck-clang-include-path for option "-I "不是字符串列表
。
最佳答案
eval
伪变量有助于在局部变量配置中进行评估。
例如:
如果您以 eval
形式设置变量,请注意设置缓冲区本地值(作为一般规则,只需使用 setq-在这些情况下,使用 local
而不是 setq
)。
关于emacs - 评估 dir locals 中的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33457580/