Re: tex-symb
Ralf Angeli <[email protected]> Wed, 09 Mar 2005 09:26:50 +0100
| Newsgroups | gmane.emacs.auc-tex |
|---|---|
| Message-ID | <[email protected]> |
* Masayuki Ataka (2005-03-09) writes:
> When I said `tex-symb is slow', I opend texbook.tex, which is
> available in CTAN, and I saw the bottom of the file (near L.28000).
> In ordinary use, tex-symb.el is not so slow ;)
>
>> > I'm not familiar with font-lock code, so jit-lock is hard road
>> > for me, either. But it is attractive for me not to check the
>> > speed of the folding algorithm.
>>
>> Well, you can already have lots of fun with something like this:
>>
>> (defadvice jit-lock-fontify-now (after TeX-jit-lock-fontify-now
>> activate)
>
> Thank you. It works fine. The speed of folding the symbol,
> even at the bottom of texbook.tex, is up.
A better way than using a defadvice is probably this:
(add-hook 'jit-lock-functions 'TeX-fold-region t t)
Unfortunately using the interface jit-lock provides
(`jit-lock-register') will add the function to the front of
`jit-lock-functions' and therefore cannot be used in this case.
>> Anyway, it is funny to see folding act like fontification, i.e. you
>> open a LaTeX file and the stuff will be folded right away.
>
> Hmm, I don't like this. Actually, I do not fontify when
> opening a LaTeX file ;)
This is gonna be tricky. I first thought one could mark the region to
be folded with a special text property (e.g. "TeX-fold-folded nil")
and then let the function in the hook mentioned above check for this.
If it is 'to-be, fold the region and mark it as folded
("TeX-fold-folded t"). The problem is, what happens if the whole
buffer already is fontified when the user requests folding? Then the
function in the hook will not get called. At this point it is no
problem to fold the region like we do now but it might get difficult
to coordinate the two possibilities of folding.
--
Ralf