[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: jit-lock doesn't honor font-lock-lines-before
From: |
martin rudalics |
Subject: |
Re: jit-lock doesn't honor font-lock-lines-before |
Date: |
Tue, 30 Aug 2005 14:11:34 +0200 |
User-agent: |
Mozilla Thunderbird 1.0 (Windows/20041206) |
Stefan Monnier wrote:
>>The customizable variable `font-lock-lines-before' is not honored by
>>jit-lock mode.
>
>
> I know what that means in therms of what the code does, but I'm wondering in
> which circumstance it makes a visible difference to the end user.
> Do you have a test case?
>
>
Suppose not: Wouldn't that mean `font-lock-lines-before' is useless?
It's not very difficult to contrive test cases for this. By default
`font-lock-multiline' is nil. `font-lock-fontify-anchored-keywords'
won't alter it - the appropriate lines have been commented out. Write
an arbitrary multiline pattern. Now font-lock won't give it the
`font-lock-multiline' text property and jit-lock not necessarily reset
its `fontified' text property after a change. `font-lock-after-change',
on the other hand, may refontify it provided `font-lock-lines-before' is
large enough.
You might argue now that the user should customize `font-lock-multiline'
appropriately and major modes set it as necessary. (By the way, is the
value `undecided' useful - I don't see tests like
`(eq font-lock-multiline t)' or `(eq font-lock-multiline 'undecided)'
anywhere?) Let's therefore suppose `font-lock-multiline' is t in the
following example: I display a buffer in a new window, and jump
immediately to a line within a multiline pattern. More precisely, the
first line of the pattern is before window-start and the last line of
the pattern appears within the window. In this case, the pattern might
not be fontified properly - fontification triggered by redisplay does
not fontify text before window-start. Modifying the first line of the
window will cause redisplay to consider only that line (and possibly
subsequent ones). The pattern will not be fontified properly unless I
scroll to its beginning. Plain font-lock, on the other hand, could
handle this case when `font-lock-lines-before' is set appropriately.
However, I believe that `font-lock-lines-before' is a brute force
approach to handle such cases and could remarkably slow down editing if
it were honored by jit-lock mode. Multiline patterns are too delicate
and should be treated in a completely different way.