Thien-Thi Nguyen wrote: > Richard Stallman 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.