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: Stefan Monnier
Subject: Re: perl mode color highlighting working badly
Date: Wed, 12 Oct 2005 10:27:34 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> In general this problem occurs with patterns like

> foo
> ---
> bar

> where syntax or appearance of `bar' depend on something font-lock
> calculates when it encounters `foo' and font-lock's scan stops at the
> `---'.

Such multi-line patterns are indeed a problem, which is why they're mostly
unsupported except for the case where you use font-lock-multiline and except
for the case where the appearance of `bar' only depends on syntax-table
properties on foo.

> 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.

> 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.

>> Already applying font-lock-syntactic-keywords to "all" the buffer defeats
>> the purpose of jit-lock.  Applying font-lock-syntactic-face-function in the
>> same way would defeat it even more, and this only because perl-mode uses it
>> in a sneaky way (perl-mode is the only mode which suffers from this
>> problem).

> jit-lock breaks font-lock's handling of syntax-table properties anyway.
> Having syntactic properties behave correctly only for positions
> preceding `font-lock-syntactically-fontified' means that I can't parse
> text after that position reliably with `parse-sexp-lookup-properties'
> non-nil.

But the same problem happens without jit-lock if you don't turn on
font-lock.  Actually, in my experience, most/all the weird corner cases that
seem to be caused by jit-lock can be reproduced without jit-lock.

> By the way, doesn't `tex-font-lock-syntactic-face-function'
> try a similar hack with "\verb?...?" constructs?

It used to.  I just changed it a few days ago.

> And there's also the commented out
> `python-font-lock-syntactic-face-function'.

But as you say, that one is commented out.


        Stefan




reply via email to

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