help-gnu-emacs
[Top][All Lists]
Advanced

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

overlays vs text properties


From: Eric Abrahamsen
Subject: overlays vs text properties
Date: Tue, 12 Jul 2011 23:12:20 -0700
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/23.2 (gnu/linux)

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




reply via email to

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