GNU bug report logs - #57150
29.0.50; [PATCH] Add test coverage for overlay modification hooks

Previous Next

Package: emacs;

Reported by: Matt Armstrong <matt <at> rfc20.org>

Date: Fri, 12 Aug 2022 04:34:01 UTC

Severity: normal

Tags: patch

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ihor Radchenko <yantar92 <at> gmail.com>
To: rms <at> gnu.org
Cc: matt <at> rfc20.org, Eli Zaretskii <eliz <at> gnu.org>, 57150 <at> debbugs.gnu.org
Subject: bug#57150: 29.0.50; [PATCH] Add test coverage for overlay modification hooks
Date: Wed, 17 Aug 2022 18:05:00 +0800
Richard Stallman <rms <at> gnu.org> writes:

> The first question is, should these use text properties instead of
> overlays?

It may be possible, but there are non-trivial implications when one
attempts to replace overlays with text properties. Some
implications I can remember quickly:

(1) Overlays do not overwrite original properties and thus removing
    overlays automatically recovers the original properties. Not so
    easily when using text properties.
(2) Overlays are not copied when the text is killed. Text properties
    are. Overlays are also not carried between indirect buffers.
(3) Inserting text inside overlays automatically inherits their
    properties. To do the same with text properties, one must use
    special functions like `insert-and-inherit', which is not common in
    packages.

To conclude, overlays and text-properties are similar in many aspects,
but also handled differently in other aspects. These differences make it
very annoying to change from overlays to text property approaches.

> Are they using many overlays to highlight many potential matches in a
> long buffer?  If so, would it make sense to show, at any time, only those
> that are near point?  When you move to a far-away part of the buffer,
> it could add highlighting to the matches near there.  But maybe it
> can avoid ever trying to highlight more than a few parts of the buffer.

I guess it can be a valid optimization in some cases. But it is not
always possible. For example, consider folded headlines in Org mode.
They have some initial folding state set when opening the file, but the
state can be changed any time by the user. It is technically challenging
to put overlays on the fly in such scenario.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




This bug report was last modified 2 years and 318 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.