bug#58537: CC Mode 5.35.1 (C/*l); Keywords being fontified as types at random

Po Lu via CC-Mode-help <[email protected]> Tue, 18 Oct 2022 09:04:23 +0800
Newsgroups gmane.emacs.cc-mode.general
Message-ID <[email protected]>
Alan Mackenzie <[email protected]> writes:

> Hello, Po.
>
> On Mon, Oct 17, 2022 at 14:24:59 +0800, Po Lu wrote:
>> Alan Mackenzie <[email protected]> writes:
>
> [ .... ]
>
>> BTW, there is still another case that isn't fixed: place the following
>> text in a C mode buffer:
>
>> {
>>   Data *tem;
>
>>   for (tem = surface->items; tem; tem = tem->next)
>>     {
>>       if (tem->type == tem)
>> 	return tem;
>>     }
>
>>   /* Next, allocate some new client data.  */
>
>>   test->a = b;
>> }
>
>> and move point to the line above "test->a = b", and type
>
>>   TAB t e m SPC = SPC foo ;
>
>> "tem" will become fontified as a type, and will also be stuck that way.
>
> Thanks for taking the trouble to report this.
>
> The problem is C Mode prematurely recognising tem in "tem \n test" as a
> type, since there are two adjacent identifiers.
>
> Please try out the following patch (which also includes yesterday's
> change).  It also aims to solve the same problem when instead of
>
>     test->a = b;
>
> there is
>
>     test (foo);
>
> ..
>
>> Thanks.
>
> Does this patch, together with that for bug #58534 also solve #58539, or
> is that still giving trouble?

Could you please send it as an attachment instead?  Thanks.