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: How to make a new mode based on c++-mode Date: 4 Dec 2006 08:10:54 -0800 Organization: http://groups.google.com Message-ID: <1165248654.455807.262380@l12g2000cwl.googlegroups.com> References: NNTP-Posting-Host: dough.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: sea.gmane.org 1165250441 12661 80.91.229.10 (4 Dec 2006 16:40:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 4 Dec 2006 16:40:41 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 04 17:40:39 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by dough.gmane.org with esmtp (Exim 4.50) id 1GrGro-0004sY-TU for geh-help-gnu-emacs@m.gmane.org; Mon, 04 Dec 2006 17:40:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GrGro-0007dP-F4 for geh-help-gnu-emacs@m.gmane.org; Mon, 04 Dec 2006 11:40:32 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!l12g2000cwl.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 31 Original-NNTP-Posting-Host: 163.244.62.65 Original-X-Trace: posting.google.com 1165248659 16253 127.0.0.1 (4 Dec 2006 16:10:59 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Mon, 4 Dec 2006 16:10:59 +0000 (UTC) In-Reply-To: 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 EMF1ASPROXY03 Complaints-To: groups-abuse@google.com Injection-Info: l12g2000cwl.googlegroups.com; posting-host=163.244.62.65; posting-account=hWoAPxMAAAAnBKSBz1ZivwUPPjEuve7bvVCHZQ8rhrluPfwcBJd92w Original-Xref: shelby.stanford.edu gnu.emacs.help:143651 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:39254 Archived-At: Helfer Thomas wrote: > following awk.el i have tried the following : > > ;;; -*-emacs-lisp-*- > ;;; castfront.el --- ELisp package for making castfront related stuff > easier. > > (provide 'castfront) > > (defconst castfront-keywords > (list > (list > "\\(@\\(Coef\\)\\)\\>" > '(0 font-lock-warning-face prepend)) > )) > > ;;;###autoload > (define-derived-mode castfront-mode c++-mode "CASTFRONT" > "Major mode for editing castfront code." > (setq font-lock-defaults '(castfront-keywords))) > > This make @Coef to be highlighted by not standard c++-keywords. What I > am doing wrong ? What you have written probably works. However your new mode is not in font-lock-global-modes so turning on global-font-lock mode doesn't turn it on. The common solution is to add a hook to turn font-lock on for your new mode in .emacs for example. This applies whether or not you're using a derived mode.