From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.help Subject: overlays vs text properties Date: Tue, 12 Jul 2011 23:12:20 -0700 Message-ID: <87k4bmk8u3.fsf@ericabrahamsen.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1310537644 2167 80.91.229.12 (13 Jul 2011 06:14:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 13 Jul 2011 06:14:04 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 13 08:13:57 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Qgshp-00068c-PL for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Jul 2011 08:13:57 +0200 Original-Received: from localhost ([::1]:57679 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qgsho-0005Jo-ER for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Jul 2011 02:13:56 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:40647) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QgsgX-0005Jh-12 for help-gnu-emacs@gnu.org; Wed, 13 Jul 2011 02:12:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QgsgW-000306-3a for help-gnu-emacs@gnu.org; Wed, 13 Jul 2011 02:12:36 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:52910) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QgsgV-000300-SN for help-gnu-emacs@gnu.org; Wed, 13 Jul 2011 02:12:36 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QgsgU-0005kd-MV for help-gnu-emacs@gnu.org; Wed, 13 Jul 2011 08:12:34 +0200 Original-Received: from 63.226.249.211 ([63.226.249.211]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 13 Jul 2011 08:12:34 +0200 Original-Received: from eric by 63.226.249.211 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 13 Jul 2011 08:12:34 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 30 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 63.226.249.211 User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:yUCxY8/m6R4cGYwkSJnt/YBjgoQ= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:81563 Archived-At: 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