From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark P Newsgroups: gmane.emacs.help Subject: Re: help with font locking Date: Thu, 12 Jan 2006 20:28:47 GMT Organization: SBC http://yahoo.sbc.com Message-ID: <3_yxf.267$Jd.145@newssvr25.news.prodigy.net> References: <2hhxf.91$Jd.25@newssvr25.news.prodigy.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1137102143 21124 80.91.229.2 (12 Jan 2006 21:42:23 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 12 Jan 2006 21:42:23 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 12 22:42:18 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 1ExACd-0005U6-JP for geh-help-gnu-emacs@m.gmane.org; Thu, 12 Jan 2006 22:41:51 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ExAEj-0006UQ-T1 for geh-help-gnu-emacs@m.gmane.org; Thu, 12 Jan 2006 16:44:01 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!atl-c02.usenetserver.com!news.usenetserver.com!newscon02.news.prodigy.com!prodigy.net!newsmst01b.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr25.news.prodigy.net.POSTED!5a60e384!not-for-mail User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041206 Thunderbird/1.0 Mnenhy/0.7.2.0 X-Accept-Language: en-us, en Original-Newsgroups: gnu.emacs.help In-Reply-To: Original-Lines: 44 Original-NNTP-Posting-Host: 64.169.83.211 Original-X-Complaints-To: abuse@prodigy.net Original-X-Trace: newssvr25.news.prodigy.net 1137097727 ST000 64.169.83.211 (Thu, 12 Jan 2006 15:28:47 EST) Original-NNTP-Posting-Date: Thu, 12 Jan 2006 15:28:47 EST X-UserInfo1: Q[R_@SRDTRREB^LXBBHZOUL@USXB@DTMNHWB_EYLJZ]BGIELLNTC@AWZWDXZXQ[K\FFSKCVM@F_N_DOBWVWG__LG@VVOIPLIGX\\BU_B@\P\PFX\B[APHTWAHDCKJF^NHD[YJAZMCY_CWG[SX\Y]^KC\HSZRWSWKGAY_PC[BQ[BXAS\F\\@DMTLFZFUE@\VL Original-Xref: shelby.stanford.edu gnu.emacs.help:136991 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:32607 Archived-At: Kevin Rodgers wrote: > Mark P wrote: > >> I'm trying to edit my .emacs file so that in c++-mode a frequently >> used user-defined type "Coord" is highlighted like any built-in type >> (int, bool, etc.) I searched around for a while but found only very >> limited information. The best I could produce was the following: >> >> ;; customize font-locking >> (font-lock-add-keywords >> 'c++-mode >> '(("\\<\\(Coord\\)" 1 font-lock-type-face) >> ) ) >> >> This sort of works. In a statement like: >> >> Coord fcn (Coord x); >> >> "Coord" is highlighted twice, but neither "fcn" nor "x" is. In a >> normal statement like: >> >> int fcn (int x) >> >> "int" is highlighted as are "fcn" and "x". >> >> Can anyone suggest a way to make the behavior for Coord match that for >> int. Any links to detail documentation on how this works would also >> be appreciated. (For example, why all the quotes and slashes in the >> .emacs code?) > > > Maybe http://simon.nitro.dk/dotfiles/emacs/ctypes.el is what you need: > > (autoload 'ctypes-define-type "ctypes" > "Add a new TYPE to current major mode and inform font-lock." t) > > (add-hook 'c++-mode-hook > (lambda () > (ctypes-define-type "Coord"))) > That worked! Thanks! -Mark