【问题标题】:How do I set buffer local variable from Eval: in .dir-local.el?如何从 Eval 设置缓冲区局部变量:在 .dir-local.el 中?
【发布时间】:2010-05-14 12:03:13
【问题描述】:

为什么会这样

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

这不是吗?

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

我在这里做错了什么?

我在 .emacs 中设置了enable-local-eval

【问题讨论】:

  • 我正在尝试对您做类似的事情...在读取 .dir-local.el 时动态设置一些变量:可惜现在似乎不可能.

标签: emacs elisp emacs23


【解决方案1】:

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

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

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

【讨论】:

    【解决方案2】:

    显然,您假设“eval”在目录局部变量中与在文件局部变量中具有相同的特殊含义;然而文档似乎并没有证实这一点。所以我的猜测是:你根本做不到。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多