GNU bug report logs - #70435
30.0.50; cc-mode: <> are sometimes not reconized as parentheses

Previous Next

Package: emacs;

Reported by: Herman, Géza <geza.herman <at> gmail.com>

Date: Wed, 17 Apr 2024 10:48:06 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 #38 received at 70435 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Herman Géza <geza.herman <at> gmail.com>
Cc: acm <at> muc.de, Eli Zaretskii <eliz <at> gnu.org>, 70435 <at> debbugs.gnu.org
Subject: Re: bug#70435: 30.0.50; cc-mode: <> are sometimes not recognized as
 parentheses
Date: Thu, 2 May 2024 13:16:27 +0000
Hello, Géza.

On Thu, May 02, 2024 at 14:49:57 +0200, Herman, Géza wrote:

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

> > Géza, would you be prepared to do a little more testing if I modified
> > the patch?

> Sure, I'm happy to test whether a modified patch still fixes the issue.

Thanks, that's appreciated.

The modified patch is quite a bit shorter than the first one, but it does
a little more.  There was a subtle detail about deleting an unterminated
string, too.

Please remove the first patch from your cc-engine.el, then apply the
patch below.  Byte compile cc-engine.el, then load the resulting CC Mode
into a running Emacs (or restart Emacs).  The test case should (still) be
fixed.

Any testing you can do on real code would also be appreciated.  Please
confirm, again, that the bug is truly fixed, or tell me what still needs
to be fixed.  Thanks!

Here's the patch.  It should apply cleanly to the Emacs master:



diff -r 072940aaeb40 cc-engine.el
--- a/cc-engine.el	Sun Apr 14 07:59:01 2024 +0000
+++ b/cc-engine.el	Thu May 02 13:05:48 2024 +0000
@@ -7172,7 +7172,7 @@
   ;; FIXME!!!  This routine ignores the possibility of macros entirely.
   ;; 2010-01-29.
 
-  (when (> end beg)
+  (when (or old-len (> end beg))
     ;; Extend the region (BEG END) to deal with any complicating literals.
     (let* ((lit-search-beg (if (memq (char-before beg) '(?/ ?*))
 			       (1- beg) beg))
@@ -7246,7 +7246,8 @@
 		  (c-put-char-properties beg end 'syntax-table '(1))
 		  ;; If an open string's opener has just been neutralized,
 		  ;; do the same to the terminating LF.
-		  (when (and end-literal-end
+		  (when (and (> end beg)
+			     end-literal-end
 			     (eq (char-before end-literal-end) ?\n)
 			     (equal (c-get-char-property
 				     (1- end-literal-end) 'syntax-table)


-- 
Alan Mackenzie (Nuremberg, Germany).




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

Previous Next


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