How do I set buffer local variable from Eval: in .dir-local.el?

痞子三分冷 提交于 2019-12-03 21:25:31

问题


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.


回答1:


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.




回答2:


Obviously you're assuming that "eval" has the same special meaning in directory-local variables that it does in file-local variables; and yet the documentation doesn't seem to confirm this. So my guess is: you simply can't do it.



来源:https://stackoverflow.com/questions/2833928/how-do-i-set-buffer-local-variable-from-eval-in-dir-local-el

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!