[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: jit-lock refontifies too much
From: |
Richard M. Stallman |
Subject: |
Re: jit-lock refontifies too much |
Date: |
Sat, 24 Sep 2005 22:40:40 -0400 |
- Syntactic context is correctly established via the face property
assigned to a character by font-lock. As an example, font-lock
assigns a character the font-lock-string-face property iff that
character is within a string - according to the best knowledge of
syntax-ppss.
It might be worth doing this for the first character of a line, only.
That would bound the extent of refontification, but without wasting]
lots of space for text properties.
In the code that you wrote, are these properties put on characters at
the start of a line, or could they appear anywhere?
There is one complication: When text has not been fontified yet, the
comparison described above would always indicate a context change.
I do not understand that statement. When the subsequent text has
not been fontified yet, it certainly needs to be fontified.
So what is it that you perceive as a problem?
Stefan wrote:
Adding yet-another-text-property is a waste of precious CPU and
memory resources. It makes your suggestion pretty dubious. Luckily, using
syntax-ppss instead of faces should not suffer from this same initialization
problem.
How does syntax-ppss avoid the need to scan too far?
(I know you told me before, but I don't remember.)
I wonder if use of syntax-ppss will be faster than
the refontifications it saves.
You wrote:
I'm only comparing Emacs-22.1 jit-lock with my patch. On a 1GHz machine
setting jit-lock-context-time to zero seconds makes Emacs stutter when I
use auto-repeat to insert a sequence of characters.
jit-lock-context-time is not normally zero. So what exactly is the
goal of your proposal? Is the goal to make jit-lock-context-time zero
without loss of performance?
> The above problems can be "easily" addressed by changing your algorithm
to
> not look at the face property, but instead to look at the return value of
> syntax-ppss. If it hasn't changed, then we know the subsequent text
doesn't
> need refontification.
>
I don't remember any previous return value when refontifying. Calling
syntax-ppss twice for the same position in one and the same invocation
of jit-lock-fontify-now always yields the same value.
The property would last only as long as there are unhandled buffer
changes. However, it does waste resources. Too bad that syntax-ppss
won't work.
I don't understand that response.
Stefan wrote:
Oh, right, when jit-lock-fontify-now gets called, the buffer is already
changed, so you'd have to use a before-change-functions hook to remember the
syntax-ppss state before the change. Hmmm...
You'd have to cache the syntax-ppss value in a text property, perhaps
for the first char on a line.
- Re: jit-lock refontifies too much, (continued)
- Re: jit-lock refontifies too much, Stefan Monnier, 2005/09/22
- Re: jit-lock refontifies too much, martin rudalics, 2005/09/25
- Re: jit-lock refontifies too much, Richard M. Stallman, 2005/09/26
- Re: jit-lock refontifies too much, martin rudalics, 2005/09/27
- Re: jit-lock refontifies too much, Richard M. Stallman, 2005/09/28
- Re: jit-lock refontifies too much, Stefan Monnier, 2005/09/27
- Re: jit-lock refontifies too much, martin rudalics, 2005/09/28
- Re: jit-lock refontifies too much, Stefan Monnier, 2005/09/28
- Re: jit-lock refontifies too much, martin rudalics, 2005/09/29
- Re: jit-lock refontifies too much, Stefan Monnier, 2005/09/29
- Re: jit-lock refontifies too much,
Richard M. Stallman <=