小编Trị*_*gọc的帖子

在.dir-locals.el中定义新变量

我是emacs的新手。如何在.dir-locals.el中定义和使用新变量?

这是我的.dir-locals.el,它没有用。

(setq clang_args '("-isystem/usr/include/glib-2.0"
                   "-isystem/usr/lib/glib-2.0/include"))
((c-mode . ((company-clang-arguments . clang_args)
            (flycheck-clang-args . clang_args))))
Run Code Online (Sandbox Code Playgroud)

这有效

((c-mode . ((company-clang-arguments . ("-isystem/usr/include/glib-2.0"
                                        "-isystem/usr/lib/glib-2.0/include"))
            (flycheck-clang-args . ("-isystem/usr/include/glib-2.0"
                                    "-isystem/usr/lib/glib-2.0/include")))))
Run Code Online (Sandbox Code Playgroud)

根据“ 如何在.dir-local.el中从Eval:设置缓冲区局部变量”中的示例?,我尝试了其他方法,但失败了。

((c-mode . ((eval . (setq company-clang-arguments ("-isystem/usr/include/glib-2.0"
                                                   "-isystem/usr/lib/glib-2.0/include"))
            (eval . (setq flycheck-clang-args ("-isystem/usr/include/glib-2.0"
                                               "-isystem/usr/lib/glib-2.0/include"))))))
Run Code Online (Sandbox Code Playgroud)

((c-mode . ((eval . (setq clang_args ("-isystem/usr/include/glib-2.0"
                                      "-isystem/usr/lib/glib-2.0/include"))
            (company-clang-arguments . clang_args)
            (flycheck-clang-args . clang_args))))
Run Code Online (Sandbox Code Playgroud)

emacs elisp

4
推荐指数
2
解决办法
2395
查看次数

标签 统计

elisp ×1

emacs ×1