From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#70367: 30.0.50; Inconsistent Syntax Highlighting Date: Sun, 14 Apr 2024 08:33:49 +0000 Message-ID: References: <86r0f9nomy.fsf@gnu.org> <86plutnogj.fsf@gnu.org> <87bk6dozpb.fsf@gmx.net> <86le5hnkvh.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38250"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, Eli Zaretskii , Stephen Berman , 70367-done@debbugs.gnu.org To: Amol Surati Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 14 10:35:29 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rvvKi-0009jX-UP for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Apr 2024 10:35:28 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rvvKC-0004zU-LR; Sun, 14 Apr 2024 04:34:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rvvKA-0004yp-J4 for bug-gnu-emacs@gnu.org; Sun, 14 Apr 2024 04:34:54 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rvvKA-0001bB-Ao for bug-gnu-emacs@gnu.org; Sun, 14 Apr 2024 04:34:54 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rvvKL-0006nt-3A for bug-gnu-emacs@gnu.org; Sun, 14 Apr 2024 04:35:05 -0400 Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Apr 2024 08:35:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 70367 X-GNU-PR-Package: emacs Mail-Followup-To: 70367@debbugs.gnu.org, acm@muc.de, suratiamol@gmail.com Original-Received: via spool by 70367-done@debbugs.gnu.org id=D70367.171308365725696 (code D ref 70367); Sun, 14 Apr 2024 08:35:04 +0000 Original-Received: (at 70367-done) by debbugs.gnu.org; 14 Apr 2024 08:34:17 +0000 Original-Received: from localhost ([127.0.0.1]:34267 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rvvJX-0006gL-L4 for submit@debbugs.gnu.org; Sun, 14 Apr 2024 04:34:16 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:33013) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rvvJS-0006eP-Re for 70367-done@debbugs.gnu.org; Sun, 14 Apr 2024 04:34:12 -0400 Original-Received: (qmail 1542 invoked by uid 3782); 14 Apr 2024 10:33:53 +0200 Original-Received: from muc.de (p4fe15ab7.dip0.t-ipconnect.de [79.225.90.183]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 14 Apr 2024 10:33:53 +0200 Original-Received: (qmail 19467 invoked by uid 1000); 14 Apr 2024 08:33:49 -0000 Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:283259 Archived-At: Hello, Amol. On Sun, Apr 14, 2024 at 10:37:32 +0530, Amol Surati wrote: > Hello, Alan. > On Sun, 14 Apr 2024 at 08:16, Alan Mackenzie wrote: > > Thanks for taking the trouble to report this bug, and thanks even more > > for the convenient test file generator, which was extremely helpful. > Thank you for the kind words. > > On Sun, Apr 14, 2024 at 03:44:01 +0530, Amol Surati wrote: [ .... ] > > > My emacs build is devoid of most of the settings and > > > features, including GUI and tree-sitter (the config command is in > > > the original report). So it is likely that only cc-mode is affected, > > > and not c-ts-mode. > > This is indeed the case. > Understood. > > > Note also that vulkan_core.h isn't special. A C source/header file > > > with a long enough enum definition also works. Attached is a C > > > program that generates to stdout the contents of such a header > > > file. Opening the contents (after they are saved to a file by stdout > > > redirection, etc.) in emacs demonstrates the problem. > > The problem is long stretches of code (>= 500 characters) where there're > > no statement boundaries or braces. These frequently occur in enums. An > > ad hoc limit to 500 characters backward search is there for speed. > Consistent with the observed behaviour, that it is mostly enums that are > affected. > > However, this bit of code was not checking whether it found a > > brace/statement or hit the 500 char limit, hence the mis-fontification. > > The patch below tries to fix this. Would you please apply it to > > cc-mode.el (in .../lisp/progmodes), byte compile the result, and load it > > into your Emacs (or restart Emacs). Then please try it out on the real > > files that showed the bug. Please let me know if the bug really is > > fixed. (If you want any help with patching or byte compiling, feel free > > to send me private email.) > Thanks for the patch. It indeed fixes the highlighting problem on the > real file vulkan_core.h (I know about only this one real file that's affected), > as well as it does on the test file. Thanks for the rapid testing! It would appear the bug has been fixed, so I've committed the fix to Emacs, CC Mode, and XEmacs. I'm closing the bug with this post. > -Amol [ .... ] -- Alan Mackenzie (Nuremberg, Germany).