emacs-devel
[Top][All Lists]
Advanced

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

Re: Should overlays evaporate by default? Conclusion: No!


From: Peter Whaite
Subject: Re: Should overlays evaporate by default? Conclusion: No!
Date: Fri, 27 May 2005 15:23:07 -0400

Thien-Thi Nguyen <address@hidden> wrote:
> Richard Stallman <address@hidden> writes:
> 
> > The goal now is to *find* possible bugs.  The patch should set the
> > property to something unusual (maybe `never-set') by default.  When
> > such an overlay becomes empty, there should be some sort of warning.
> > That way, people will find code that perhaps ought to set the
> > evaporate property to something explicitly.
> 
> ok, below is a patch to buffer.c that does this, more or less.  the
> (%d,%d) is perhaps redundant, but since we're in the checking mood...

Thanks Thi.  I had to make a couple of changes (see below), but I have
been running with it for a few days now.

>From what I've seen I do not think it would be a good idea to change the
default.

The main reason is that there is a third, and common, use case which I
had not thought of.  This is where an overlay is used dynamically to
respond to user input, e.g. mouse.el, hl-line.el, comint, ediff, etc.
Typically a global or buffer local variable is used to hold the overlay,
which is positioned dynamically by applying move-overlay in response to
user input.  The positioning can result in the overlay becoming of zero
length.  Obviously it should not evaporate.

I did start to patch files exposed by my limited testing (see below),
but there were many, and I found I was setting 'evaporate to nil, not t.
Given that, and given that magically disappearing is in general
surprising default behaviour, then it would be better to retain the
current overlay defaults.

There remains the question of how to prevent overlay leaks.  It would
help if the elisp overlay documentation outlined the problem and
remedies ((overlay-put ovl 'evaporate t) or (remove-overlays)).  Perhaps
my original suggestion that erase-buffer also remove-overlays should be
considered.

For the record I'm attaching the patches I made to the elisp files.  A
quick grep through the lisp directory reveals many more that would need
patching.

Attachment: evaporate-el.patch
Description: Text document

Also here is my version of Thi's patch to buffer.c.  I had to avoid
calling Foverlay_put from Fmake_overlay as it caused (make-overlay 1 1)
to immediately evaporate.  The only other change was to print more
information about the overlay so it was easier to track down.

Attachment: evaporate.patch
Description: Text document

--
Peter Whaite

reply via email to

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