unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* overlays vs text properties
@ 2011-07-13  6:12 Eric Abrahamsen
  2011-07-13  6:59 ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Abrahamsen @ 2011-07-13  6:12 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

I'm learning about overlays and text properties, and am looking for some
pointers on which to use. I'm building a medium-sized package, and one
function I need is that as the user moves point through paragraphs of
text in a buffer, each paragraph should be given a certain
property/overlay. As point leaves a paragraph its properties are
deleted, and as it enters a different paragraph (either by typing or
simple movement), that new paragraph gets the properties.

I can't decide whether to use overlays or regular properties. The
advantages of using overlays seem to be:

1. I can make a single named overlay, and move it around the buffer with
   move-overlay. Nice and clean, no searching for boundaries of things
   and suchlike.
2. I can attach multiple properties to a single overlay -- saves time
   and effort, and seems like good programming.

The disadvantage seems to be the practical issue that overlays don't
come with point-entered/point-left special properties -- ie, there's no
good way of keeping track of when point is going in and out of a
paragraph with the overlay, and then moving the overlay to the
next/previous/other paragraph.

Does anyone have any experience they'd like to share on this point?
Should I just use fundamental text properties?

Thanks,
Eric




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-07-13 22:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-13  6:12 overlays vs text properties Eric Abrahamsen
2011-07-13  6:59 ` Eli Zaretskii
2011-07-13  7:23   ` Eric Abrahamsen
2011-07-13  7:28     ` Eli Zaretskii
2011-07-13  7:32       ` Eric Abrahamsen
2011-07-13  8:07         ` PJ Weisberg
2011-07-13 22:21           ` Eric Abrahamsen
2011-07-13  9:57         ` Eli Zaretskii
2011-07-13 14:55     ` Drew Adams

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