tags:

views:

176

answers:

1

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.

A: 

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.

Jim Blandy