[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: Ralf Angeli
Subject: Re: [Bug-AUCTeX] 11.83; folding, fontification and noweb ie Rnw file
Date: Sat, 16 Dec 2006 23:07:26 +0100

* Patrick Drechsler (2006-12-14) writes:

> Figure environment is folded. OK. The displayed figure environment
> contains a noweb chunk. Syntax highlighting is not correct.
> - screenshot 1 (start): http://tinyurl.com/tx9jv

I can see this with my installation as well.

> 5. Move cursor downward line by line using the arrow-cursor-down key.
> When moving the cursor downward line by line things become highlighted 
> correctly:

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.

> 6. When putting the cursor at the first position of the line [figure] 
> (line 47, position 0)

Here it is line 51.  Your mail client probably reformatted the code.

> and then expanding/unfolding it by pressing the 
> arrow-right key the figure is unfolded. OK. Cursor is on line 47, 
> position 1.
> 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))))


reply via email to

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