如何从.dir-local.el中的Eval中设置缓冲区局部变量? [英] How do I set buffer local variable from Eval: in .dir-local.el?

查看:119
本文介绍了如何从.dir-local.el中的Eval中设置缓冲区局部变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 ((nil。((编译目录。 
(compilation-command。rake))
))

这不是吗?

 ((nil。((Eval。(setq compilation-directory/ home / vava / code_directory )
(compilation-command。rake))
))

我在这里做错什么?



我已经在.emacs中设置了 enable-local-eval / p>

解决方案

Emacs Lisp区分大小写:尝试小写eval:



pre> ((nil。((eval。(setq compilation-directory/ home / vava / code_directory))
(编译命令rake)) ))

此外,目录局部变量的文件名称为 .dir- locals.el ,而不是 .dir-local.el ,如题目标题。


Why this works

((nil . ((compilation-directory . "/home/vava/code_directory/")
         (compilation-command . "rake"))
))

and this doesn't?

((nil . ((Eval . (setq compilation-directory "/home/vava/code_directory"))
         (compilation-command . "rake"))
))

What I'm doing wrong here?

I have set enable-local-eval in .emacs.

解决方案

Emacs Lisp is case-sensitive: try lower-case "eval":

((nil . ((eval . (setq compilation-directory "/home/vava/code_directory"))
         (compilation-command . "rake"))))

Also, the name of the file for directory-local variables is .dir-locals.el, not .dir-local.el as in the question headline.

这篇关于如何从.dir-local.el中的Eval中设置缓冲区局部变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆