【问题标题】:Buffer-local variables with Emacs and Sweave使用 Emacs 和 Sweave 的缓冲区局部变量
【发布时间】:2010-01-19 16:53:27
【问题描述】:

我正在使用 Emacs 23.1 和 ESS 5.4 来编辑 Sweave 文件。我想关闭缓冲区中默认的 AUCTeX 缩进行为(以避免对包含在逐项列表中的代码块造成困扰),所以在文件的顶部我有% -*- LaTeX-indent-level: 0; LaTeX-item-indent: 0; -*-。当我打开缓冲区并运行C-h v LaTeX-indent-level 时,我得到了我想要的:

LaTeX-indent-level is a variable defined in `latex.el'.
Its value is 0
Local in buffer test.Rnw; global value is 2

  This variable is a file local variable.

但是,在我编辑代码块后,它会恢复为默认行为。 C-h v LaTeX-indent-level 现在产生:

LaTeX-indent-level is a variable defined in `latex.el'.
Its value is 2

我尝试了the noweb-mode FAQ 中建议的修复,建议添加

(add-hook 'noweb-select-mode-hook
              '(lambda () (hack-local-variables-prop-line)))

到我的 .emacs。当我这样做时,上述行为仍然存在。

有什么方法可以让缓冲区局部变量在这种情况下工作?我不希望在所有 Sweave/noweb 缓冲区中更改我的 .emacs 以将 LaTeX-indent-level 设置为 0。

【问题讨论】:

    标签: emacs r sweave


    【解决方案1】:

    我没有对此进行测试,但请尝试以下方法:

    (add-hook 'noweb-select-mode-hook
                  '(lambda () (hack-local-variables)))
    

    也许 hack-local-variables-prop-line 已更改为仅解析值,而不是恢复它们。

    【讨论】:

      猜你喜欢
      • 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
      相关资源
      最近更新 更多