我使用 Emacs 23.1 和 ESS 5.4 来编辑 Sweave 文件。我想关闭缓冲区中默认的 AUCTeX 缩进行为(以避免逐项列表中包含的代码块带来麻烦),因此在文件顶部我有 % -*- LaTeX-indent-level: 0; LaTeX-项目缩进:0; -*-
。当我打开缓冲区并运行 Ch 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.
但是,在编辑代码块后,它会返回默认行为。 Ch v LaTeX-indent-level
现在产生:
LaTeX-indent-level is a variable defined in `latex.el'.
Its value is 2
我尝试了 noweb-mode FAQ,建议添加
(add-hook 'noweb-select-mode-hook
'(lambda () (hack-local-variables-prop-line)))
到我的 .emacs。当我这样做时,上述行为仍然存在。
有什么方法可以让缓冲区局部变量在这种情况下工作吗?我不想在所有 Sweave/noweb 缓冲区中更改我的 .emacs 将 LaTeX-indent-level
设置为 0。
I'm using Emacs 23.1 with ESS 5.4 to edit an Sweave file. I'd like to turn off the default AUCTeX indentation behavior in the buffer (to avoid annoyances with code chunks contained in itemized lists), so at the top of the file I have % -*- LaTeX-indent-level: 0; LaTeX-item-indent: 0; -*-
. When I open the buffer and run C-h v LaTeX-indent-level
, I get what I wanted:
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.
However, after I edit a code chunk, it returns to the default behavior. C-h v LaTeX-indent-level
now yields:
LaTeX-indent-level is a variable defined in `latex.el'.
Its value is 2
I tried the fix suggested in the noweb-mode FAQ, which suggests adding
(add-hook 'noweb-select-mode-hook
'(lambda () (hack-local-variables-prop-line)))
to my .emacs. The behavior described above persisted when I did this.
Is there any way I can get buffer-local variables to work in this situation? I would prefer not to have to change my .emacs to set LaTeX-indent-level
to 0 in all Sweave/noweb buffers.
发布评论
评论(1)
我还没有对此进行测试,但请尝试以下操作:
也许 hack-local-variables-prop-line 已更改为仅解析值,而不是声明它们。
I haven't tested this, but try the following instead:
Perhaps hack-local-variables-prop-line has been changed to merely parse the values, not instate them.