unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stephen Berman <Stephen.Berman@gmx.net>
To: help-gnu-emacs@gnu.org
Subject: Re: Font-Locking for Allout Mode
Date: Sat, 10 Mar 2007 00:34:26 +0100	[thread overview]
Message-ID: <87k5xqat4t.fsf@escher.local.home> (raw)
In-Reply-To: jwvodn2jgsy.fsf-monnier+gnu.emacs.help@gnu.org

On Fri, 09 Mar 2007 15:36:29 -0500 Stefan Monnier
<monnier@iro.umontreal.ca> 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

  parent reply	other threads:[~2007-03-09 23:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-07 20:07 Font-Locking for Allout Mode Tassilo Horn
2007-03-08 13:23 ` Stephen Berman
     [not found] ` <mailman.654.1173360249.7795.help-gnu-emacs@gnu.org>
2007-03-08 14:03   ` Tassilo Horn
2007-03-08 16:06     ` Stephen Berman
     [not found]     ` <mailman.663.1173370034.7795.help-gnu-emacs@gnu.org>
2007-03-08 16:42       ` Tassilo Horn
2007-03-08 22:38         ` Peter Dyballa
2007-03-08 22:45         ` Stephen Berman
     [not found]         ` <mailman.686.1173393546.7795.help-gnu-emacs@gnu.org>
2007-03-08 22:49           ` Tassilo Horn
     [not found]         ` <mailman.687.1173393945.7795.help-gnu-emacs@gnu.org>
2007-03-08 23:18           ` Tassilo Horn
2007-03-09 11:28             ` Stephen Berman
     [not found]             ` <mailman.704.1173439750.7795.help-gnu-emacs@gnu.org>
2007-03-09 14:27               ` Tassilo Horn
2007-03-09 16:50                 ` Stephen Berman
2007-03-11 15:07                   ` Stephen Berman
2007-03-09 20:36               ` Stefan Monnier
2007-03-09 21:44                 ` Tassilo Horn
2007-03-09 23:34                 ` Stephen Berman [this message]
2007-03-09 23:47                   ` Stephen Berman
2007-03-11 15:07                   ` Stephen Berman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k5xqat4t.fsf@escher.local.home \
    --to=stephen.berman@gmx.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).