bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Alan Mackenzie
Subject: bug#43558: [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).





reply via email to

[Prev in Thread] Current Thread [Next in Thread]