From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.help Subject: Re: Font-Locking for Allout Mode Date: Sun, 11 Mar 2007 16:07:53 +0100 Message-ID: <87r6rvn7hy.fsf@escher.local.home> References: <87mz2o3jib.fsf@baldur.tsdh.de> <877itrn86x.fsf@baldur.tsdh.de> <87tzwvlmad.fsf@baldur.tsdh.de> <87k5xrl3xp.fsf@baldur.tsdh.de> <873b4ev6f2.fsf@baldur.tsdh.de> <87odn2bbtf.fsf@escher.local.home> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1173625851 11146 80.91.229.12 (11 Mar 2007 15:10:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 11 Mar 2007 15:10:51 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Mar 11 16:10:26 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HQPgm-0003Gn-KV for geh-help-gnu-emacs@m.gmane.org; Sun, 11 Mar 2007 16:10:24 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HQPhK-0007Jg-NU for geh-help-gnu-emacs@m.gmane.org; Sun, 11 Mar 2007 10:10:58 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HQPh6-0007Ia-Aq for help-gnu-emacs@gnu.org; Sun, 11 Mar 2007 11:10:44 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HQPh5-0007HK-LD for help-gnu-emacs@gnu.org; Sun, 11 Mar 2007 11:10:43 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HQPh5-0007H0-AX for help-gnu-emacs@gnu.org; Sun, 11 Mar 2007 10:10:43 -0500 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HQPgW-0007el-4r for help-gnu-emacs@gnu.org; Sun, 11 Mar 2007 11:10:08 -0400 Original-Received: from root by ciao.gmane.org with local (Exim 4.43) id 1HQPgP-0006Mr-TQ for help-gnu-emacs@gnu.org; Sun, 11 Mar 2007 16:10:01 +0100 Original-Received: from i577bc120.versanet.de ([87.123.193.32]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 11 Mar 2007 16:10:01 +0100 Original-Received: from Stephen.Berman by i577bc120.versanet.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 11 Mar 2007 16:10:01 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 57 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: i577bc120.versanet.de User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.93 (gnu/linux) X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) 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: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:41882 Archived-At: On Fri, 09 Mar 2007 17:50:52 +0100 Stephen Berman wrote: > On Fri, 09 Mar 2007 15:27:13 +0100 Tassilo Horn > wrote: > >> Stephen Berman writes: >> >> Hi Stephen, >> >>> Our discussion convinced me that the code from the Emacs wiki wasn't >>> playing well with Emacs lisp mode, so I fiddled with it and came up >>> with a variant that works in Emacs lisp mode. Replace your >>> th-allout-font-lock-keywords with the following: > [...] >> Yes, now it works. But I get a lot of the messages below in *Messages*: >> >> ,---- >> | Invalid face reference: 2 >> | Invalid face reference: 1 [9 times] >> | Invalid face reference: 2 [2 times] >> `---- > > I didn't notice them before, but I get them too. The message comes > from merge_face_ref in xfaces.c, and a comment there says: "FACE_REF > ought to be a face name." This apparently means that the face > specification I gave is flawed, although the results look ok. But I'm > afraid I'm out of my depth here. If we're lucky some font-lock guru > will notice this thread and help us. Font-Lock guru Stefan Monnier's post provided the necessary help, though my first attempt to make use of it was wrong. But the following works and uses valid face references: (defvar srb-allout-font-lock-keywords '((eval . (list (concat "^\\(?:" allout-regexp "\\).+") 0 '(cond ((= (allout-depth) 1) font-lock-function-name-face) ((= (allout-depth) 2) font-lock-variable-name-face) ((= (allout-depth) 3) font-lock-keyword-face) ((= (allout-depth) 4) font-lock-builtin-face) ((= (allout-depth) 5) font-lock-comment-face) ((= (allout-depth) 6) font-lock-constant-face) ((= (allout-depth) 7) font-lock-type-face) ((= (allout-depth) 8) font-lock-string-face) (t font-lock-warning-face)) t nil))) "Additional expressions to highlight in Allout mode.") Steve Berman