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: Sat, 10 Mar 2007 00:34:26 +0100 Message-ID: <87k5xqat4t.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> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1173483312 8297 80.91.229.12 (9 Mar 2007 23:35:12 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 9 Mar 2007 23:35:12 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Mar 10 00:35:08 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 1HPoc5-00073O-Ji for geh-help-gnu-emacs@m.gmane.org; Sat, 10 Mar 2007 00:35:05 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HPocP-0004cJ-Ui for geh-help-gnu-emacs@m.gmane.org; Fri, 09 Mar 2007 18:35:25 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HPocD-0004bv-Mj for help-gnu-emacs@gnu.org; Fri, 09 Mar 2007 18:35:13 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HPocC-0004bi-7F for help-gnu-emacs@gnu.org; Fri, 09 Mar 2007 18:35:13 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HPocC-0004bf-10 for help-gnu-emacs@gnu.org; Fri, 09 Mar 2007 18:35:12 -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 1HPobo-0007yB-J1 for help-gnu-emacs@gnu.org; Fri, 09 Mar 2007 18:34:48 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1HPoba-00058Z-R6 for help-gnu-emacs@gnu.org; Sat, 10 Mar 2007 00:34:36 +0100 Original-Received: from i577bc629.versanet.de ([87.123.198.41]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 10 Mar 2007 00:34:34 +0100 Original-Received: from Stephen.Berman by i577bc629.versanet.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 10 Mar 2007 00:34:34 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 66 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: i577bc629.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:41851 Archived-At: On Fri, 09 Mar 2007 15:36:29 -0500 Stefan Monnier wrote: >> (defvar th-allout-font-lock-keywords >> '((eval . (list (concat "^\\(?:" allout-regexp "\\).+") >> 0 '(cond ((= (allout-depth) 1) >> '(1 . font-lock-function-name-face)) > ^^^^ > WTH is this for? Thanks for the heads up. To my embarassment, I blindly retained the conses while fiddling with the following code from http://www.emacswiki.org/cgi-bin/wiki/AllOut, to try and get it to work in Emacs lisp mode: (defvar rf-allout-font-lock-keywords '(;; ;; Highlight headings according to the level. (eval . (list (concat "^\\(" outline-regexp "\\).+") 0 '(or (cdr (assq (outline-depth) '((1 . font-lock-function-name-face) (2 . font-lock-variable-name-face) (3 . font-lock-keyword-face) (4 . font-lock-builtin-face) (5 . font-lock-comment-face) (6 . font-lock-constant-face) (7 . font-lock-type-face) (8 . font-lock-string-face)))) font-lock-warning-face) nil t))) "Additional expressions to highlight in Outline mode.") The proper adaptation should be the following, right? (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 nil))) "Additional expressions to highlight in Allout mode.") While I have your attention, do you have any answers to the questions I raised in this thread, namely (i) why does rf-allout-font-lock-keywords, unlike srb-allout-font-lock-keywords, not work in Emacs lisp mode, and (ii) why does a file visited in Text mode require `mode: allout' as a file local variable when using srb-allout-font-lock-keywords in order to get the fontification automatically, why a file visited in Emacs lisp mode does not need this file local variable? I'd appreciate any insight you have on these questions. Steve Berman