[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: changing precedence in font-lock-add-keywords
From: |
Dieter Wilhelm |
Subject: |
Re: changing precedence in font-lock-add-keywords |
Date: |
Fri, 24 Nov 2006 22:22:32 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
"sandro.dentella" <sandro@e-den.it> writes:
> Hi,
>
> i'm trying to customize a mode for cheetah templating system, it is
> derived from html-mode and seems pretty simple:
>
> (define-derived-mode cheetah-mode html-mode "Cheetah"
> (make-face 'cheetah-variable-face)
> (font-lock-add-keywords
> nil
> '(
> ("\\(#\\(end \\)?\\(include.*\\|block.*\\|import\\|load\\)\\)" 1
> font-lock-builtin-face)
> ("\\(##.*\\)" 1 font-lock-comment-face)
> ("\\(#\\*.*\\*#\\)" 1 font-lock-comment-face)
> ("\\(#\\(from\\|else\\|set\\|import\\|for\\|if\\|end\\)+\\)\\>" 1
> font-lock-keyword-face)
> ("\\(<%.*%>\\)" 1 font-lock-keyword-face)
> ;;
> ("\\(#\\(from\\|for\\|end\\)\\).*\\<\\(for\\|import\\|if\\|in\\)\\>" 3
> font-lock-keyword-face)
> ("\\(\\$\\(?:\\sw\\|}\\|{\\|\\s_\\)+\\)" 1
> font-lock-variable-name-face)
> ))
> (font-lock-mode 1)
> )
>
> what I'd like to optain is that the regexp defined here take precedence
> over those defined in html-mode. As an example the line with <% %> gets
> colored as it would in html but i'd like it to show as a keyword.
I think
("\\(<%.*%>\\)" 1 font-lock-keyword-face append)
should do the trick already.
--
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany