unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kin Cho <kin@techie.com>
Subject: Re: C type fontification help
Date: 22 May 2003 10:42:59 -0700	[thread overview]
Message-ID: <7in0heop24.fsf@neoscale.com> (raw)
In-Reply-To: 5lk7cmo8xy.fsf@rum.cs.yale.edu

"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

      reply	other threads:[~2003-05-22 17:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-19 21:35 C type fontification help Kin Cho
2003-05-19 22:42 ` Stefan Monnier
2003-05-22 17:42   ` Kin Cho [this message]

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7in0heop24.fsf@neoscale.com \
    --to=kin@techie.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).