[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: allout and font-locking
From: |
Stephen Berman |
Subject: |
Re: allout and font-locking |
Date: |
Wed, 07 Mar 2012 21:13:08 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) |
On Tue, 06 Mar 2012 12:27:54 -0500 Marc Croteau <mdcroteau@gmail.com> wrote:
> I'm having problems getting the font-locking features to work. I hope
> someone can help me.
> I have allout (version 2.3) working just fine but the color highlighting is
> NOT
> working.
>
> I'm running emacs 23.3 on a ubuntu box running 11.10.
> I've tried the suggestions made in (1) the emacswiki with respect to
> (defvar rf-allout-font-lock-keywords...
> and (2) suggestions in this mailing list by Stephen Berman and also
> Tassilo Horn and don't seem to get the color highlighting I'm
> expecting.
The code I posted here five years ago still works for me on openSUSE's
Emacs 23.3 (as well as with the current trunk). I tested by saving your
test file, starting emacs with -Q and evaluating the following:
--8<---------------cut here---------------start------------->8---
(require 'allout)
(require 'allout-widgets)
(allout-init t)
(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.")
(defun srb-allout-font-lock-mode ()
(font-lock-add-keywords nil srb-allout-font-lock-keywords))
(add-hook 'allout-mode-hook 'srb-allout-font-lock-mode)
--8<---------------cut here---------------end--------------->8---
Then I visited the test file and each instance of "test" had a different
color. Can you try the same test?
Steve Berman