[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Patrick Drechsler
Subject: Re: [Bug-AUCTeX] 11.83; folding, fontification and noweb ie Rnw file
Date: Wed, 20 Dec 2006 19:16:37 +0100
User-agent: Thunderbird (X11/20061117)

I am including the ESS list..

For ESS readers: My original post containing a complete problem description can be found here:


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

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)
                               (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...



[1] GNU Emacs (i686-pc-linux-gnu, GTK+ Version 2.8.20) of 2006-12-14 on trurl

reply via email to

[Prev in Thread] Current Thread [Next in Thread]