From: "Robert Thorpe" <rthorpe@realworldtech.com>
Subject: Re: changing precedence in font-lock-add-keywords
Date: 23 Nov 2006 09:36:15 -0800 [thread overview]
Message-ID: <1164303375.589927.283110@l39g2000cwd.googlegroups.com> (raw)
In-Reply-To: <1164206164.086152.236680@f16g2000cwb.googlegroups.com>
sandro.dentella wrote:
> 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.
>
> Any hints?
See the awk-mode.el file in the Emacs distribution for an example of
how to do this.
It's in /lisp/progmodes.
next prev parent reply other threads:[~2006-11-23 17:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-22 14:36 changing precedence in font-lock-add-keywords sandro.dentella
2006-11-23 17:36 ` Robert Thorpe [this message]
2006-11-24 21:22 ` Dieter Wilhelm
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=1164303375.589927.283110@l39g2000cwd.googlegroups.com \
--to=rthorpe@realworldtech.com \
/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).