emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: perl mode color highlighting working badly


From: martin rudalics
Subject: Re: perl mode color highlighting working badly
Date: Thu, 13 Oct 2005 14:04:41 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

>>foo
>>---
>>ba
>
>
>>to
>
>
>>foo
>>---
>>bar
>
>
>>which to my knowledge neither font-lock nor jit-lock can handle.
>
>
> I'm tempted to say "no, that should work just fine".  But really, it all
> depends on many more details of how foo and bar relate.

When

foo
---
ba

is fontified you have two choices: (a) Don't set a multiline property,
or (b) set a property from `foo' till - in the worst case - the end of
the buffer.  With (a) neither font-lock nor jit-lock will handle this.
I have not seen an application using (b) yet.

>
>>Or, insert a stretch of text containing `foo' and `bar' such that `foo'
>>ends up before `window-start' and `bar' within the window.  This would be
>>handled by pure font-lock but here `font-lock-syntactic-keywords' might
>>fail with jit-lock since neither `font-lock-syntactically-fontified' gets
>>adjusted properly nor is the inserted region fontified immediately.
>
>
> I do not understand what you mean by "might fail".  AFAIK this should work
> just fine.
>

Once set in a buffer `font-lock-syntactically-fontified' is never reset
to a lower position.  It's all contained in the following piece of code:

  (when (and font-lock-syntactically-fontified
             (< font-lock-syntactically-fontified start))
    (setq start (max font-lock-syntactically-fontified (point-min)))
    (setq font-lock-syntactically-fontified end))

Suppose `font-lock-syntactically-fontified' equals N in the current
buffer.  If you now insert a larger stretch of code at any position
before N you rely on font-lock to investigate the entire inserted code
in its syntactic keyword pass.  With pure font-lock this is done in
`font-lock-after-change-function'.  With jit-lock this is not done for
those parts of the inserted code that are not displayed in a window.





reply via email to

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