From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Robert Thorpe" Newsgroups: gmane.emacs.help Subject: Re: changing precedence in font-lock-add-keywords Date: 23 Nov 2006 09:36:15 -0800 Organization: http://groups.google.com Message-ID: <1164303375.589927.283110@l39g2000cwd.googlegroups.com> References: <1164206164.086152.236680@f16g2000cwb.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: sea.gmane.org 1164390588 26208 80.91.229.2 (24 Nov 2006 17:49:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 24 Nov 2006 17:49:48 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 24 18:49:47 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GnfBD-0000Le-EK for geh-help-gnu-emacs@m.gmane.org; Fri, 24 Nov 2006 18:49:40 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GnfBC-0005Ba-Tr for geh-help-gnu-emacs@m.gmane.org; Fri, 24 Nov 2006 12:49:38 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!l39g2000cwd.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 37 Original-NNTP-Posting-Host: 213.94.228.210 Original-X-Trace: posting.google.com 1164303381 32237 127.0.0.1 (23 Nov 2006 17:36:21 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 23 Nov 2006 17:36:21 +0000 (UTC) In-Reply-To: <1164206164.086152.236680@f16g2000cwb.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6,gzip(gfe),gzip(gfe) X-HTTP-Via: 1.0 EMF3ASPROXY03 Complaints-To: groups-abuse@google.com Injection-Info: l39g2000cwd.googlegroups.com; posting-host=213.94.228.210; posting-account=hWoAPxMAAAAnBKSBz1ZivwUPPjEuve7bvVCHZQ8rhrluPfwcBJd92w Original-Xref: shelby.stanford.edu gnu.emacs.help:143303 Original-To: help-gnu-emacs@gnu.org 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:38920 Archived-At: 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.