开发者

Buffer-local variables with Emacs and Sweave

开发者 https://www.devze.com 2022-12-17 16:45 出处:网络
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)

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 de开发者_开发技巧scribed 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.


I haven't tested this, but try the following instead:

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

Perhaps hack-local-variables-prop-line has been changed to merely parse the values, not instate them.

0

精彩评论

暂无评论...
验证码 换一张
取 消