[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C type fontification help
From: |
Kin Cho |
Subject: |
Re: C type fontification help |
Date: |
22 May 2003 10:42:59 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
"Stefan Monnier" <monnier+gnu.emacs.help/news/@flint.cs.yale.edu> writes:
> > I need help fontifying "FOO(a)" as type and "bar" as variable below:
> > struct foo {
> > FOO(a) bar;
> > };
> > I tried adding "FOO([^)]+)" to c-font-lock-extra-types but it
> > doens't help because c-font-lock-extra-types doens't expect word
> > delimiters.
>
> You might want to try something like
>
> (add-hook 'c-mode-hook
> (lambda ()
> (set (make-local-variable 'font-lock-syntactic-keywords)
> '(("FOO([^)]+)" (0 '(2))))))
>
> To first change the syntax-class of the open and close paren to "word".
> That's pretty ugly but it should work (probably with some fiddling).
I have given up on relying on font-lock for parsing.
I'm experimenting with xemacs.org's semantic now and it looks
good so far -- although it still wouldn't associate "FOO(a)" as
the type of "bar", but at least "bar" is parsed as a variable.
Thanks.
-kin