From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: font lock woes Date: Mon, 04 Mar 2013 11:03:42 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1362413065 5773 80.91.229.3 (4 Mar 2013 16:04:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 Mar 2013 16:04:25 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Mar 04 17:04:49 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UCXsc-0004cO-Jf for geh-help-gnu-emacs@m.gmane.org; Mon, 04 Mar 2013 17:04:46 +0100 Original-Received: from localhost ([::1]:49211 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCXsG-0000ry-Pf for geh-help-gnu-emacs@m.gmane.org; Mon, 04 Mar 2013 11:04:24 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:45892) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCXru-0000rg-4r for help-gnu-emacs@gnu.org; Mon, 04 Mar 2013 11:04:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UCXrp-0003XY-7s for help-gnu-emacs@gnu.org; Mon, 04 Mar 2013 11:04:02 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:54782) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCXrp-0003XR-1Z for help-gnu-emacs@gnu.org; Mon, 04 Mar 2013 11:03:57 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UCXs9-0004Ds-5d for help-gnu-emacs@gnu.org; Mon, 04 Mar 2013 17:04:17 +0100 Original-Received: from 69-196-187-203.dsl.teksavvy.com ([69.196.187.203]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 04 Mar 2013 17:04:17 +0100 Original-Received: from monnier by 69-196-187-203.dsl.teksavvy.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 04 Mar 2013 17:04:17 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 30 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 69-196-187-203.dsl.teksavvy.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:/OYJ8gRI6uZsHurAQKUtVvqCxQw= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:89342 Archived-At: > This suggests to me that I should be able to do: > ,---- > | (font-lock-add-keywords nil `((,(regexp-quote "{++") . '(face cm-addition-face read-only t))) t) > `---- > but for some reason, the only thing that works is: > ,---- > | (font-lock-add-keywords nil `((,(regexp-quote "{++") 0 '(face cm-addition-face read-only t)) > `---- In which way does the other one not work? Did you check the resulting font-lock-keywords? > A second thing I don't understand is how to remove the read-only > property again when the mode is deactivated. I was thinking I should be > able to do the following: > ,---- > | (font-lock-remove-keywords nil `((,(regexp-quote "{++") 0 '(face cm-addition-face read-only t)))) > | (let ((inhibit-read-only t)) > | (font-lock-fontify-buffer)) > | (setq font-lock-extra-managed-props (delq 'read-only font-lock-extra-managed-props)) > `---- font-lock-fontify-buffer just schedules a refontification, which will be done later, on-the-fly, piece by piece as text is displayed. Much simpler is to remove-text-properties by hand. Stefan