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

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

Re: About intervals


From: Xue Fuqiao
Subject: Re: About intervals
Date: Wed, 20 Mar 2013 18:25:51 +0800

On Tue, 19 Mar 2013 20:24:08 -0400
Stefan Monnier <monnier@iro.umontreal.ca> wrote:

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

I think so, too.

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

The manual's references to intervals are both concepts.  See:
(info "(elisp) Garbage Collection")
(info "(elisp) Memory Usage")
(info "(elisp) Buffer Internals")

But AFAIK there are not any disambiguation about these two meanings in
Emacs manuals.

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

I think overlays often cause some problems (although they are minor).
E.g.,
http://lists.gnu.org/archive/html/emacs-devel/2005-11/msg01346.html

So I don't use it much, anyway.

-- 
Happy birthday, GNU Emacs!
1985-2013



reply via email to

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