* Patrick Drechsler (2006-12-20) writes: > I am including the ESS list..
Removing for this message again because it is only concerned with folding. > Ralf Angeli wrote: > >> I'm not sure why Noweb mode has to call the mode function every time >> it leaves a noweb chunk. This might become resource intensive if the >> mode does a lot of initialization stuff and does not keep track of >> running it only once. Whatever. In your case this means you should >> make sure that `TeX-fold-buffer' is run only once after you load a >> LaTeX/noweb file. You could do this by introducing a buffer-local >> variable you check and set in your hook: >> >> (defvar pd-folding-done-p nil) >> (make-variable-buffer-local 'pd-folding-done-p) >> (add-hook 'LaTeX-mode-hook (lambda () >> (unless pd-folding-done-p >> (TeX-fold-mode 1) >> (TeX-fold-buffer) >> (setq pd-folding-done-p t)))) > > Thanks for taking the time Ralf! > > I have tried your code both using the Emacs version mentioned in the OP > as well as with Emacs 23[1]. I do not see any difference in behaviour. Ugh, I should probably test the code before I post it. But I'm quite baffled now because I thought this was a sure shot. The code does not work because in the hook the global value of `pd-folding-done-p' is checked. When setting a breakpoint on `TeX-fold-buffer' I get the following backtrace: Debugger entered--entering a function: * TeX-fold-buffer() (if pd-folding-done-p nil (TeX-fold-mode 1) (TeX-fold-buffer) (setq pd-folding-done-p t)) (unless pd-folding-done-p (TeX-fold-mode 1) (TeX-fold-buffer) (setq pd-folding-done-p t)) (lambda nil (unless pd-folding-done-p (TeX-fold-mode 1) (TeX-fold-buffer) (setq pd-folding-done-p t)))() run-hooks(text-mode-hook TeX-mode-hook LaTeX-mode-hook) apply(run-hooks (text-mode-hook TeX-mode-hook LaTeX-mode-hook)) TeX-run-mode-hooks(text-mode-hook TeX-mode-hook LaTeX-mode-hook) latex-mode() noweb-select-mode() noweb-post-command-function() run-hooks(post-command-hook) Now when I check `pd-folding-done-p' with `C-h v', the local value I can see when using `C-h v' in the LaTeX buffer is not there. Does anybody have an idea why? -- Ralf _______________________________________________ bug-auctex mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-auctex
