From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: how to prevent font-lock from messing with a portion of text? Date: Fri, 23 Mar 2007 18:31:09 +0100 Message-ID: <46040EDD.8070908@gmail.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1174671096 13992 80.91.229.12 (23 Mar 2007 17:31:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 23 Mar 2007 17:31:36 +0000 (UTC) Cc: Emacs-Devel To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 23 18:31:20 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 1HUnbj-0007Jq-Ep for ged-emacs-devel@m.gmane.org; Fri, 23 Mar 2007 18:31:19 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HUnde-00029T-It for ged-emacs-devel@m.gmane.org; Fri, 23 Mar 2007 12:33:18 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HUndb-00028m-6N for emacs-devel@gnu.org; Fri, 23 Mar 2007 13:33:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HUnda-00028a-3D for emacs-devel@gnu.org; Fri, 23 Mar 2007 13:33:14 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HUndZ-00028X-WA for emacs-devel@gnu.org; Fri, 23 Mar 2007 12:33:14 -0500 Original-Received: from ch-smtp01.sth.basefarm.net ([80.76.149.212]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HUnbd-0004E5-Uw for emacs-devel@gnu.org; Fri, 23 Mar 2007 13:31:14 -0400 Original-Received: from c83-254-145-24.bredband.comhem.se ([83.254.145.24]:63389 helo=[127.0.0.1]) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.63) (envelope-from ) id 1HUnbc-00022C-3I; Fri, 23 Mar 2007 18:31:12 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.5.666 In-Reply-To: X-Antivirus: avast! (VPS 000727-0, 2007-03-22), Outbound message X-Antivirus-Status: Clean X-Scan-Result: No virus found in message 1HUnbc-00022C-3I. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1HUnbc-00022C-3I deab8c526c5aaa46897c2e51fad2211f X-detected-kernel: Linux 2.6? (barebone, rare!) 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:68420 Archived-At: Drew Adams wrote: > Wrt Lennart's suggestion, BTW: I want to be able to also remove the > highlighting and then have font-lock treat that text normally again. So, > nothing that permanently prevents font-lock from fontifying the text would > be useful here. I understand that my suggestion does not fit your needs now, but it is quite easy to let font-lock take over the fontifying again. > As a simple example, imagine that you want to be able to use `M-o o' > (facemenu-set-face) on some text in a font-locked buffer. Currently, `M-o o' > just tells you that "Font-lock mode will override any faces you set in this > buffer" - IOW, you're SOL. If you want to see your highlighting, you must > turn off font-lock. Instead of punting this way, `M-o o' could do what's > needed to prevent font-lock from interfering - that is, from changing the > facemenu highlighting. To do that kind of thing you want you have to change font-lock-fontify-region function. However that will not work for all modes, only those that uses this. So at the moment you really can not do it. To temporary set a face like you want to do I think you need to use overlays. > BTW, the doc does not explain anywhere (that I've found) just how the > activation of `font-lock-face' is controlled by `font-lock-mode'. It says > only that the mode toggles the activation of the property. It seems to me that there are indeed things missing in the manual.