From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: How to prevent font-lock (& jit-lock etc.) from refontifying? Date: Tue, 12 Oct 2004 12:51:55 -0700 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1097623063 32476 80.91.229.6 (12 Oct 2004 23:17:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 12 Oct 2004 23:17:43 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 13 01:17:31 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CHVta-0006LZ-00 for ; Wed, 13 Oct 2004 01:17:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CHW0Y-00053O-UF for geh-help-gnu-emacs@m.gmane.org; Tue, 12 Oct 2004 19:24:42 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CHVsz-0002tW-7q for help-gnu-emacs@gnu.org; Tue, 12 Oct 2004 19:16:53 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CHVsy-0002tE-9I for help-gnu-emacs@gnu.org; Tue, 12 Oct 2004 19:16:52 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CHVsx-0002t3-S6 for help-gnu-emacs@gnu.org; Tue, 12 Oct 2004 19:16:52 -0400 Original-Received: from [199.232.41.8] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1CHVjs-0006a3-TX for help-gnu-emacs@gnu.org; Tue, 12 Oct 2004 19:07:29 -0400 Original-Received: from [148.87.2.204] (helo=inet-mail4.oracle.com) by mx20.gnu.org with esmtp (Exim 4.34) id 1CHSp9-0000F8-4W for help-gnu-emacs@gnu.org; Tue, 12 Oct 2004 16:00:45 -0400 Original-Received: from rgmgw3.us.oracle.com (rgmgw3.us.oracle.com [138.1.191.12]) by inet-mail4.oracle.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id i9CJkR1q008906 for ; Tue, 12 Oct 2004 12:46:30 -0700 (PDT) Original-Received: from rgmgw3.us.oracle.com (localhost [127.0.0.1]) by rgmgw3.us.oracle.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id i9CJpxoC020397 for ; Tue, 12 Oct 2004 13:51:59 -0600 Original-Received: from dradamslap (dhcp-amer-csvpn-gw2-141-144-81-146.vpn.oracle.com [141.144.81.146]) by rgmgw3.us.oracle.com (Switch-3.1.4/Switch-3.1.0) with SMTP id i9CJpxoa020384 for ; Tue, 12 Oct 2004 13:51:59 -0600 Original-To: "Help-Gnu-Emacs" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 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 Xref: main.gmane.org gmane.emacs.help:21223 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:21223 In Emacs 21, suppose that I apply a face to certain spans of text. Maybe the buffer is already font-locked before doing this, maybe not. In either case, I want these spans of text to show the face I apply, overriding any font-lock highlighting that might be there. However, font-lock (jit-lock, I believe) works behind the scene to refontify things the way it thinks they should look. That is, it effectively _removes_ any highlighting I go to the trouble to add. In Emacs 20, I only had to worry about lazy-lock doing this, and function lazy-lock-after-fontify-buffer was available to convince lazy-lock not to undo things behind my back. I could just call that function after highlighting, to fool lazy-lock into thinking there was no need to rehighlight. This function, lock-after-fontify-buffer, is still available in Emacs 21. However, in Emacs 21, I do not see an equivalent way (or any other way) to prevent _jit-lock_ from undoing my highlighting changes. Example: (put-text-property start end 'face some-face), where start and end specify the text span to be highlighted, and some-face is just what it says. I can set the buffer read-only and modified-p states back to what they were before my highlighting action, but jit-lock still refontifies behind the scene, overriding the some-face highlighting I added. I've checked the source code (font-lock.el, jit-lock.el) and the Elisp manual, but I don't see how to deal with this. Please don't reply that I should just use font-lock-keywords and let font-lock do the highlighting. Assume that there is a reason I want to add some-face as the 'face property using put-text-property. Thanks.