Subject: bug#35454: 26.2.50; CC-Mode fontification fails inside macro

From: Alan Mackenzie <[email-masked]>
Date: Thu, 2 May 2019 14:42:23 +0000

Hello again, Mauro.

On Thu, May 02, 2019 at 08:57:14 +0000, Alan Mackenzie wrote:
> On Wed, May 01, 2019 at 19:31:48 -0300, Mauro Aranda wrote:
> > Alan Mackenzie <[email-masked]> writes:

> > I've applied the patch and tried the recipe I provided, and it works fine.

> > However, when I visit editfns.c and search for EXTRA_CONTEXT_FIELDS,
> > like I said in my report, I see the following problem with this variables:
> > struct buffer *buffer_a;
> > struct buffer *buffer_b;
> > unsigned char *deletions;
> > unsigned char *insertions;

> > All but deletions have face font-lock-variable-name-face.

[ .... ]

> The problem with "deletions" seems to be triggered by the 2-line comment
> in the macro not having a backslash escaping the \n.  In nearly 30 years
> hacking C, I've never seen this before, and didn't even know it was
> valid syntax.  However, this means at least four very commonly used
> functions (c-beginning-of-macro, c-end-of-macro, c-forward-sws, and
> c-backward-sws) are going to have to be amended to deal with it, and
> this is inevitably going to make CC Mode slower.  :-(

I've just committed a fix to multiline comments in macros not having
escaped newlines.  This seems to solve the problem with the variable
"deletions".  That should be half the battle won.  As usual, please feel
free to test it for me.

In the end, it didn't make CC Mode more than around 0.5% slower.

I haven't yet tried combining yesterday's patch with the fix I've just
committed, but if we're lucky, the two together might solve the entire
bug.

[ .... ]

> > Best regards,
> > Mauro.

-- 
Alan Mackenzie (Nuremberg, Germany).