GNU bug report logs - #70367
30.0.50; Inconsistent Syntax Highlighting

Previous Next

Package: emacs;

Reported by: Amol Surati <suratiamol <at> gmail.com>

Date: Sat, 13 Apr 2024 16:40:04 UTC

Severity: normal

Found in version 30.0.50

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


Message #34 received at 70367-done <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Amol Surati <suratiamol <at> gmail.com>
Cc: acm <at> muc.de, Eli Zaretskii <eliz <at> gnu.org>,
 Stephen Berman <stephen.berman <at> gmx.net>, 70367-done <at> debbugs.gnu.org
Subject: Re: bug#70367: 30.0.50; Inconsistent Syntax Highlighting
Date: Sun, 14 Apr 2024 08:33:49 +0000
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 <acm <at> muc.de> 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).




This bug report was last modified 1 year and 39 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.