When I scroll through an Sweave document (Rnw) with latex and R code, the text jumps around when the mode changes between Latex and ESS. The two modes disagree how text should be wrapped. Moreover, I've noticed that when I do
the truncated long lines mode is no longer on. Has anyone noticed this? Has anyone solved this problem?
By reading a similar question on the [email protected] mailing list, this is what I've learned. When we scroll through the noweb file, we are switching major modes from ESS to LaTeX. Most major modes kill all local variables as part of their initialization, so when we just set the variable locally it's overwritten. To solve this, I modified a hook I found:
(add-hook 'LaTeX-mode-hook '(lambda () (if (string-match "\\.Rnw\\'" buffer-file-name) (setq fill-column 80))))
You could set a similar hook for longlines-mode or toggle-truncate-lines, etc, to meet your needs. The downside to this solution is that you're stuck with a single value for the variable set in the hook.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With