unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: rms@gnu.org
Cc: matt@rfc20.org, Eli Zaretskii <eliz@gnu.org>, 57150@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	[thread overview]
Message-ID: <87zgg3yylv.fsf@localhost> (raw)
In-Reply-To: <E1oO98g-0008JS-3o@fencepost.gnu.org>

Richard Stallman <rms@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





  reply	other threads:[~2022-08-17 10:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-12  4:32 bug#57150: 29.0.50; [PATCH] Add test coverage for overlay modification hooks Matt Armstrong
2022-08-12  4:41 ` Matt Armstrong
2022-08-12  6:19   ` Eli Zaretskii
2022-08-12 17:57     ` Matt Armstrong
2022-08-12 18:53       ` Eli Zaretskii
2022-08-14  4:52     ` Matt Armstrong
2022-08-14  7:15       ` Eli Zaretskii
2022-09-04 21:59       ` Lars Ingebrigtsen
2022-08-13  4:07 ` Ihor Radchenko
2022-08-14  0:44   ` Matt Armstrong
2022-08-15  4:14     ` Ihor Radchenko
2022-08-15 11:26       ` Eli Zaretskii
2022-08-17  2:50         ` Richard Stallman
2022-08-17 10:05           ` Ihor Radchenko [this message]
2022-08-17 11:51           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zgg3yylv.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=57150@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=matt@rfc20.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).