From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: how to prevent font-lock from messing with a portion of text? Date: Mon, 26 Mar 2007 08:56:59 -0700 Message-ID: References: <87odmgrv96.fsf@catnip.gol.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1174924763 1502 80.91.229.12 (26 Mar 2007 15:59:23 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 26 Mar 2007 15:59:23 +0000 (UTC) Cc: Emacs-Devel To: "Miles Bader" , "Stefan Monnier" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 26 17:59:15 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HVrbH-0004ZC-2X for ged-emacs-devel@m.gmane.org; Mon, 26 Mar 2007 17:59:15 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HVrdW-0002JQ-PD for ged-emacs-devel@m.gmane.org; Mon, 26 Mar 2007 11:01:34 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HVrcq-000183-2p for emacs-devel@gnu.org; Mon, 26 Mar 2007 12:00:52 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HVrcn-00015S-Mt for emacs-devel@gnu.org; Mon, 26 Mar 2007 12:00:51 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HVrcn-00015H-0Y for emacs-devel@gnu.org; Mon, 26 Mar 2007 11:00:49 -0500 Original-Received: from rgminet01.oracle.com ([148.87.113.118]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HVraV-00026E-9Z; Mon, 26 Mar 2007 11:58:27 -0400 Original-Received: from rgmgw2.us.oracle.com (rgmgw2.us.oracle.com [138.1.186.111]) by rgminet01.oracle.com (Switch-3.2.4/Switch-3.1.6) with ESMTP id l2QFwOei005773; Mon, 26 Mar 2007 09:58:24 -0600 Original-Received: from acsmt351.oracle.com (acsmt351.oracle.com [141.146.40.151]) by rgmgw2.us.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l2QFwMA6008641; Mon, 26 Mar 2007 09:58:22 -0600 Original-Received: from dhcp-amer-whq-csvpn-gw3-141-144-81-70.vpn.oracle.com by acsmt350.oracle.com with ESMTP id 2562438171174924622; Mon, 26 Mar 2007 08:57:02 -0700 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: <87odmgrv96.fsf@catnip.gol.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 Importance: Normal X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-kernel: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:68622 Archived-At: > > OK, here's another option: don't change anything to font-lock, > > don't fiddle with it at all, just don't use text-properties to > > add your special faces. Use overlays instead. > > Typical "highlighter" applications seem a bit more suited to overlays > anyway (e.g., if I copy the text, I don't really expect the highlighting > to come along...). You know, you need not read my posts, but if you don't read them, then you need not reply to them either. I explicitly stated that my own highlighting library lets you use either overlays or text properties, and that using overlays is the default behavior. Text properties and overlays act differently, and there can be advantages to each in different contexts. One is not a replacement for the other, whether for "typical" highlighting or anything else. > I suppose if there's some reason to use text-properties, "hi-lock.el" > (in the distribution) could be used as an example of one way to do that. > [It actually _uses_ font-lock to do the highlighting which seems fairly > clever -- e.g., if you type more text after having highlighted a phrase, > the phrase gets automagically highlighted in the new text too!] I'm well aware of hi-lock, and I use it. There are advantages and disadvantage to tying user highlighting to the font-lock mechanism. With it, you cannot view the highlighting without font-lock-mode being on. Here is one comparison of some different highlighting approaches: http://www.emacswiki.org/cgi-bin/wiki/HighlightTemporarily. Nothing wrong with hi-lock. Nothing wrong with facemenu. Different approaches have different advantages. Why not let highlighting approaches, such as facemenu, that use the `face' text property independently of whether font-lock highlighting is on, be able to prevent font lock from erasing their highlighting?