[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Advising in cc-awk.el and namespace
From: |
Stefan Monnier |
Subject: |
Re: Advising in cc-awk.el and namespace |
Date: |
Wed, 16 Jul 2003 11:28:40 -0400 |
> A change at pos N potentially changes the output of syntax-ppss for
> all pos>N, so jit-lock just refontifies everything (in the background
> with jit-lock-stealth-*). Of course, in practice the output of
> syntax-ppss is generally not changed for all pos>N but only for N<pos<M
> (or sometimes it is changed for all pos>N but the change is marginal or
> irrelevant and will not influence the result of font-locking), so we could
> be more clever, but we would need to cache the parse-state-before-change
> so we can compare it to the parse-state-after-change so we can stop when
> they are equal again.
>
> It would not be hard to cache the syntactic state every N lines in a
> text property, and that way it would be possible to notice when
> things get back in sync and end refontification.
>
> However, another solution is to stop refontifying at the next
> start-of-defun after the last change. That should be really simple.
> Could someone give that a try?
That's a very good idea.
The only problem for is that we don't really have that info right now.
The only thing that jit-lock knows is whether to do the "contextual
refontification" or not. Font-lock and syntax.el know a little bit more,
in that they know how to find the previous start-of-defun, but not the next
one (although depending on the value of font-lock-beginning-of-syntax-function
and/or syntax-begin-function, the next-start-of-defun can be inferred).
Stefan