help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: About intervals


From: Stefan Monnier
Subject: Re: About intervals
Date: Tue, 19 Mar 2013 20:24:08 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> I think RMS had some dispute with Lucid people whether the interval tree
> is good idea; it was one reason why XEmacs was forked and I think it's
> the reason why this is mentioned in the manual at all.

I think the reason is related but different:
while text-properties are implemented with a balanced tree whose
name in the C code is "interval", the manual's reference to intervals is
for things like overlays and extents, whereas from that point of view
text-properties do not behave like intervals:

When you use put-text-property, you just add that property to each
char in the specified range.  Whereas when you use an overlay or an
extent you put the property on the interval that contains those chars.

That looks very similar, but if you later insert a char somewhere in the
middle, this char will necessarily be part of the interval, whereas it
will not have the text-property that was set to the surrounding chars
(unless you specifically ask to inherit those properties, e.g. via
insert-and-inherit).

Other differences are that you can query the set of intervals (extents,
or overlays) that cover a particular position in the buffer, but that
same question is meaningless for text-properties.  At best you can find
the neighboring chars whose property has the same value.


        Stefan




reply via email to

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