[Top][All Lists]

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

Re: CC-mode highlight change between 24.5 and 25

From: Alan Mackenzie
Subject: Re: CC-mode highlight change between 24.5 and 25
Date: Tue, 6 Sep 2016 17:02:17 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

Hello, Oleh.

On Tue, Sep 06, 2016 at 03:37:55PM +0200, Oleh Krehel wrote:
> Hi Alan,

> Alan Mackenzie <address@hidden> writes:

[ .... ]

> > So, please try out the following, and let me know, again, how it copes
> > with real C++ code.  Thanks!

> I'm testing the updated code. Looks much better. But I attach an example
> where it still highlights a variable as a function. It's a strange
> example as well: the comments and previous statements are significant. I
> reduced the code to around 10 lines and it's not easy to reduce further.

Thanks for taking the trouble to reduce it.  It really does help!

> Here's how I test it:

>     emacs -Q cctest.cc

> The variable `gfs' is highlighted as a function. The highlight is quite
> volatile: adding a newline before the line removes the highlight.

I've tracked the cause of this down.  The line with "gfs" is at the
start of a (500 byte) jit-lock fontification hunk.  So CC Mode checks
whether the first form in the hunk is really a sub-form of what just
came before.

It then calls a critical function `c-font-lock-declarators', but
_without_ the &optional new argument `not-top' which should be t to
signify "not at the top level".  So this identifier gets fontified as
though it were at the top level, i.e. as a function.

Note that if you fontify the line with M-o M-o, for example, the above
scenario doesn't occur, and the id gets font-lock-variable-name-face.

There are quite a few calls to `c-font-lock-declarators', and I'm going
to have to attend to each one of them individually.  So, give me a
little time, and then I'll send you patch version 3.

> Oleh

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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