GNU bug report logs - #43558
[PATCH]: Fix (forward-comment 1) when end delimiter is escaped.

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Tue, 22 Sep 2020 09:36:02 UTC

Severity: normal

Tags: confirmed

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Alan Mackenzie <acm <at> muc.de>
Subject: bug#43558: closed (Re: bug#43558: [PATCH]: Fix (forward-comment
 1) when end delimiter is escaped.)
Date: Wed, 23 Sep 2020 08:58:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#43558: [PATCH]: Fix (forward-comment 1) when end delimiter is escaped.

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 43558 <at> debbugs.gnu.org.

-- 
43558: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=43558
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Alan Mackenzie <acm <at> muc.de>
To: 43558-done <at> debbugs.gnu.org
Subject: Re: bug#43558: [PATCH]: Fix (forward-comment 1) when end delimiter
 is escaped.
Date: Wed, 23 Sep 2020 08:57:46 +0000
Bug fixed in master.

-- 
Alan Mackenzie (Nuremberg, Germany).

[Message part 3 (message/rfc822, inline)]
From: Alan Mackenzie <acm <at> muc.de>
To: bug-gnu-emacs <at> gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: [PATCH]: Fix (forward-comment 1) when end delimiter is escaped.
Date: Tue, 22 Sep 2020 09:35:50 +0000
Hello, Emacs and Stefan.

In the following C comment:

1   /*
2     \*/
3   /**/

, with point at BOL 1, do M-: (forward-comment 1).  This leaves point
wrongly at EOL 2.  It should end up at EOL 3, since the apparent comment
ender on L2 is actually escaped.

The following patch fixes this.  Are there any objections to me
installing it?


diff --git a/src/syntax.c b/src/syntax.c
index e6af8a377b..066972e6d8 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -2354,6 +2354,13 @@ forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
 	/* We have encountered a nested comment of the same style
 	   as the comment sequence which began this comment section.  */
 	nesting++;
+      if (comment_end_can_be_escaped
+          && (code == Sescape || code == Scharquote))
+        {
+          inc_both (&from, &from_byte);
+          UPDATE_SYNTAX_TABLE_FORWARD (from);
+          if (from == stop) continue; /* Failure */
+        }
       inc_both (&from, &from_byte);
       UPDATE_SYNTAX_TABLE_FORWARD (from);
 

-- 
Alan Mackenzie (Nuremberg, Germany).



This bug report was last modified 3 years and 47 days ago.

Previous Next


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