>>>>"SJT" == Stephen J Turnbull
<turnbull(a)sk.tsukuba.ac.jp> writes:
>>>> "Hrvoje" == Hrvoje Niksic <hniksic(a)srce.hr> writes:
Hrvoje> Jan Vroonhof <vroonhof(a)math.ethz.ch> writes:
>> Why is font-lock using text-properties anyway? Isn't what
it
>> does much more naturally mapped on extents.
Hrvoje> Not really (although it may look that way at the start).
Hrvoje> The font-lock code wants to apply certain properties to
Hrvoje> parts of the buffer, merging or breaking the extents as
Hrvoje> needed. This is exactly what the text-properties are for.
SJT> Could you be more specific? The documentation says something quite
SJT> different: text-properties are for attaching properties to characters
SJT> rather than intervals.
That's exactly what font-lock is supposed to do: attaching faces to
characters matched by specific (parts of) font-lock keywords.
SJT> That seems like exactly the _wrong_ thing to do with strings and
SJT> comments, both of which should be locked up in an unbreakable
SJT> (from the point of view of font-lock) extent once identified;
There are not such things like unbreakable extents in font-lock: parts
of previously fontified characters can get additional/new face
properties, etc. In fact, two extents are "glumped" if appropriate,
e.g., for a TeX sequence like \alpha\beta.
SJT> the individual characters in them should never be considered
SJT> "locally".
???
SJT> OTOH, I don't see why splitting an extent or merging neighboring
SJT> extents (which should be constant time, with relatively high overhead
SJT> I suppose) should be more efficient than iterating over a (possibly
SJT> lengthy) interval of characters (linear time but possibly lower
SJT> overhead, depending on the implementation, although I find it hard to
SJT> see why it would be necessarily much less than for extents).
This probably depends: the display is faster, the fontification not.
- Christoph