From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: help with font locking
Date: Thu, 12 Jan 2006 10:31:56 -0700 [thread overview]
Message-ID: <dq63qf$n50$1@sea.gmane.org> (raw)
In-Reply-To: <2hhxf.91$Jd.25@newssvr25.news.prodigy.net>
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")))
--
Kevin Rodgers
next prev parent reply other threads:[~2006-01-12 17:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-12 0:20 help with font locking Mark P
2006-01-12 17:31 ` Kevin Rodgers [this message]
2006-01-12 20:06 ` Alan Mackenzie
2006-01-13 0:27 ` Mark P
[not found] ` <mailman.847.1137087711.26925.help-gnu-emacs@gnu.org>
2006-01-12 20:28 ` Mark P
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='dq63qf$n50$1@sea.gmane.org' \
--to=ihs_4664@yahoo.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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.