unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: "Herman Géza" <geza.herman@gmail.com>
Cc: acm@muc.de, Eli Zaretskii <eliz@gnu.org>, 70435@debbugs.gnu.org
Subject: bug#70435: 30.0.50; cc-mode: <> are sometimes not recognized as parentheses
Date: Thu, 2 May 2024 13:16:27 +0000	[thread overview]
Message-ID: <ZjOSKwu_3SxMEE9L@ACM> (raw)
In-Reply-To: <87zft8s7dh.fsf@gmail.com>

Hello, Géza.

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

> Alan Mackenzie <acm@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).





  reply	other threads:[~2024-05-02 13:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-17 10:47 bug#70435: 30.0.50; cc-mode: <> are sometimes not reconized as parentheses Herman, Géza
2024-04-27  8:33 ` Eli Zaretskii
2024-04-27 10:08   ` Alan Mackenzie
2024-04-28 15:44 ` Alan Mackenzie
2024-04-28 16:47   ` Herman, Géza
2024-04-28 20:31     ` Alan Mackenzie
2024-04-29 15:53     ` Alan Mackenzie
2024-04-29 17:21       ` Herman, Géza
2024-05-02  9:30         ` Eli Zaretskii
2024-05-02 10:24           ` Alan Mackenzie
2024-05-02 12:49             ` Herman, Géza
2024-05-02 13:16               ` Alan Mackenzie [this message]
2024-05-02 19:58                 ` bug#70435: 30.0.50; cc-mode: <> are sometimes not recognized " Herman, Géza
2024-05-05 11:55                   ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZjOSKwu_3SxMEE9L@ACM \
    --to=acm@muc.de \
    --cc=70435@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=geza.herman@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).