From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#35454: 26.2.50; CC-Mode fontification fails inside macro Date: Thu, 2 May 2019 08:57:14 +0000 Message-ID: <20190502085714.GA4277@ACM> References: <20190427203646.GA11087@ACM> <20190501210230.GA3999@ACM> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="52743"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: 35454@debbugs.gnu.org To: Mauro Aranda Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu May 02 10:58:15 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hM7Xh-000DY9-TI for geb-bug-gnu-emacs@m.gmane.org; Thu, 02 May 2019 10:58:14 +0200 Original-Received: from localhost ([127.0.0.1]:47872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hM7Xg-0006nh-V0 for geb-bug-gnu-emacs@m.gmane.org; Thu, 02 May 2019 04:58:12 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hM7XZ-0006nb-11 for bug-gnu-emacs@gnu.org; Thu, 02 May 2019 04:58:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hM7XW-0005TG-VY for bug-gnu-emacs@gnu.org; Thu, 02 May 2019 04:58:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60254) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hM7XV-0005Su-V3; Thu, 02 May 2019 04:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hM7XV-0001G7-P5; Thu, 02 May 2019 04:58:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Thu, 02 May 2019 08:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35454 X-GNU-PR-Package: emacs,cc-mode Original-Received: via spool by 35454-submit@debbugs.gnu.org id=B35454.15567874414791 (code B ref 35454); Thu, 02 May 2019 08:58:01 +0000 Original-Received: (at 35454) by debbugs.gnu.org; 2 May 2019 08:57:21 +0000 Original-Received: from localhost ([127.0.0.1]:45564 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hM7Wr-0001FD-0y for submit@debbugs.gnu.org; Thu, 02 May 2019 04:57:21 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:56091 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1hM7Wo-0001F2-EL for 35454@debbugs.gnu.org; Thu, 02 May 2019 04:57:19 -0400 Original-Received: (qmail 54821 invoked by uid 3782); 2 May 2019 08:57:15 -0000 Original-Received: from acm.muc.de (p4FE15E7B.dip0.t-ipconnect.de [79.225.94.123]) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 02 May 2019 10:57:14 +0200 Original-Received: (qmail 4536 invoked by uid 1000); 2 May 2019 08:57:14 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:158623 Archived-At: Hello, Mauro. On Wed, May 01, 2019 at 19:31:48 -0300, Mauro Aranda wrote: > Alan Mackenzie writes: > Hello Alan. Thanks for looking into this bug! > > Please try out the patch below. On my system, it corrects the > > fontification in both your test file and editfns.c. > 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. > I can't seem to come up with a simple recipe to reproduce the problem, > so I refer you to that part of editfns.c. Thanks, I didn't notice these last night, but I can see them now. > All the following steps, separately with emacs -Q (or you could kill the > buffer if you want) > 1) C-x C-f editfns.c > C-s extra RET > I observe deletions without its correspondent face and if I type: > SPC DEL > deletions gets font-lock-variable-name-face face. However, if I > revert the buffer with M-x revert-buffer RET yes RET buffer_a, deletions > and the first 'buffer' lose their faces. 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 can't see at the moment any pattern with the fontification on buffer_a. Sometimes just scrolling the buffer a few lines makes buffer_a lose its fontification. But if an empty pair of parentheses is put after EXTRA_CONTEXT_FIELDS, all these problems go away. So they seem related to what I half-fixed last night. > 2) C-x C-f editfns.c > C-s deletions RET > I see that deletions has the right face. But > M-x revert-buffer > makes it lose it (but *buffer_a keeps its face). > 3) C-x C-f editfns.c > C-s extra RET > deletions without font-lock-variable-name-face. > C-l C-l > M-x revert-buffer > deletions now has font-lock-variable-name-face. > That is all the testing I could do, sorry for not being able to come up > with a better recipe. Let me know if you see the same behavior, or what > else I could try. Well, that seems like quite a lot of testing to me. :-) Thanks for doing it and reporting back to me so quickly. I'll be working on the outstanding bugs here in the next few days. > Best regards, > Mauro. -- Alan Mackenzie (Nuremberg, Germany).