How do I set buffer local variable from Eval: in .

2019-02-14 23:17发布

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.

2条回答
够拽才男人
2楼-- · 2019-02-14 23:56

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.

查看更多
仙女界的扛把子
3楼-- · 2019-02-14 23:57

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.

查看更多
登录 后发表回答