emacs-devel
[Top][All Lists]
Advanced

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

Re: address@hidden: C++-mode: Syntax highlighting: wrong color for funct


From: Stefan Monnier
Subject: Re: address@hidden: C++-mode: Syntax highlighting: wrong color for function identifier depending on the kind of whitespace that follows]
Date: Sun, 13 Mar 2005 20:07:40 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>> The problem is: how to get font-lock to refontify
>> 
>> s[foo]{
>> bar
>> }x
> /.../
>> Now, when I'm in the middle of font-locking, I've done the work of figuring
>> out that I'm in an s/foo/bar/ expression and I can easily add
>> a text-property on the whole thing.

> That doesn't work very well while the thing is entered, does it? First
> you see "s[foo]{" while it's being entered, then you see the next line
> " bar", and lastly "}x". Your patterns will never see the whole
> construct at once. (They will however see the buffer end, or even
> worse some completely unrelated code that happen to be on the
> following lines and which might confuse them.)

I use font-lock-syntactic-face-function, so I don't need to "see the whole
pattern" (I basically keep track of the intermediate state in the
parse-partial-sexp state).  It works just fine (well, admittedly, I just
tried it and there's a bug in the code that in this case ends up placing
a string-fence char on the `s' instead of the `[').

> Another problem is that the "bar" part can get arbitrarily large if
> it's code, in which case it becomes a performance problem to put a
> property on it to refontify the whole thing.

That's why I used jit-lock-defer-multiline: I only refontify the whole thing
in the "deferred" refontification, not the on-the-fly one.


        Stefan




reply via email to

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