[ESS] [Bug-AUCTeX] 11.83; folding, fontification and noweb ie Rnw file

Patrick Drechsler patrick at pdrechsler.de
Wed Dec 20 19:30:23 CET 2006

Patrick Drechsler wrote:
> I am including the ESS list..
> For ESS readers: My original post containing a complete problem 
> description can be found here:
> http://article.gmane.org/gmane.emacs.auctex.bugs/84

Sorry, typo:


> Ralf Angeli wrote:
>> * Patrick Drechsler (2006-12-14) writes:
> [...]
>> Here as well.  Without actually looking at the code my guess would be
>> that this is a problem of ESS.  It seems to use its own ways for font
>> locking because font locking is still done in buffers where ESS is
>> active even if Global Font Lock mode is disabled.
>> [...]
>>> 7. Now move the cursor downward one line using the down-arrow key 
>>> passing the end of the noweb chunk. The figure environment is 
>>> collapsed/folded before you can edit the figure caption.
>> When you leave the noweb chunk, Noweb mode calls the mode function of
>> the mode which is active at point.  In your case this is LaTeX mode.
>> The mode function of LaTeX mode will call its hook to which you added
>> a function which calls `TeX-fold-buffer'.  This makes the figure
>> collapse.
>> 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.
> This is off course no show stopper...
> Cheers
> Patrick
> [1] GNU Emacs (i686-pc-linux-gnu, GTK+ Version 2.8.20) of 
> 2006-12-14 on trurl
> ______________________________________________
> ESS-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

More information about the ESS-help mailing list