help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Syntax Highlighting Problem


From: Alan Mackenzie
Subject: Re: Syntax Highlighting Problem
Date: Tue, 5 May 2009 20:00:47 +0000
User-agent: Mutt/1.5.9i

Hi, Chris,

On Sun, May 03, 2009 at 02:28:41PM +0000, Chris Gordon-Smith wrote:
> I am fairly new to emacs, and am having a problem with syntax
> highlighting with C++.

Yes.  C++ is an utter horror of a language, impossible to parse
syntactically in the general case; so CC Mode sometimes has to guess
what's going on, and sometimes gets it wrong.

> Although the highlighting seems to be working overall, it behaves
> strangely with macros.

OK, macros are a problem in any C and C++ (and Objective C), because
they can expand to anything.  If you can, it's best to write macros so
that they "look like normal code".

> I have a trace utility that can log entry and exit to each function.
> To enable the utility for a function, I invoke a macro at the start of
> the function like this:

>      TRACE

> The odd thing is that the highlighting of the macro call is not consistent; 
> sometimes it is in one colour, sometimes in another colour.

> Can anyone help?

OK, lets have some version numbers, please.  Do M-x emacs-version and
M-x c-version (where M-x means "press x whilst holding down the alt
key").  Thanks!

Second thing, could you post a sample of source which displays the
anomaly, please - the smaller the better (5 - 20 lines is usually enough
for this).  That way, I can reproduce the problem and hopefully debug
it.

Next, what are the "faces" (i.e. colours) which get put onto the
various occurrences of TRACE?  To see this, put point (the cursor) at
the pertinent places and type C-u C-x =.  (Where the "." is not what you
type, is a full stop at the end of my sentence.)  In the results window
at the bottom, you should see something like:

    There are text properties here:
      face                 font-lock-variable-name-face

Look forward to hearing back from you!

> -- Chris Gordon-Smith London www.simsoup.info

-- 
Alan Mackenzie (Nuremberg, Germany).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]