[Top][All Lists]

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

Re: jit-lock refontifies too much

From: Stefan Monnier
Subject: Re: jit-lock refontifies too much
Date: Tue, 27 Sep 2005 11:54:24 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>     That would be overly expensive.  I rewrote all this with ppss, two
>     markers, a before-change-functions hook and without any text properties.
>     It seems to work but needs some further testing.

> That is interesting.  I would not have expected it to work.
> However, this would require doing that computation for each change,
> and that could be rather expensive, right?

Shouldn't be particularly expensive: syntax-ppss is called by font-lock
anyway, and since it uses caching, calling it a couple more times around the
same spot is pretty cheap.

> One advantage for the idea of saving it in a text property for the
> first character on each line is that it only has to be checked
> when it is time to refontify.

What his patch does is pretty much the same except he uses
before-change-functions in order to lazily only store the syntax-ppss of the
line after the change, whereas you'd eagerly store it for every line in
the buffer.

> Another possible advantage is: if things are not in sync for the first
> line after the end of the changed text, it might be in sync on a
> subsequent line, and that could avoid refontifying most of the lines
> on the screen.

My gut feeling is that this is way past the point of diminishing returns.
Already his optimization is rarely noticeable, but breaks a couple
(rare) special cases.


reply via email to

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