From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#43558: [PATCH]: Fix (forward-comment 1) when end delimiter is escaped. Date: Tue, 22 Sep 2020 09:35:50 +0000 Message-ID: <20200922093550.GA26819@ACM> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6727"; mail-complaints-to="usenet@ciao.gmane.io" To: 43558@debbugs.gnu.org, monnier@iro.umontreal.ca Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 22 11:39:16 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kKelY-0001dH-70 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Sep 2020 11:39:16 +0200 Original-Received: from localhost ([::1]:59522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kKelX-0004mL-6P for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Sep 2020 05:39:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKeiQ-000226-Ut for bug-gnu-emacs@gnu.org; Tue, 22 Sep 2020 05:36:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45698) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kKeiQ-0007Wg-KG for bug-gnu-emacs@gnu.org; Tue, 22 Sep 2020 05:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kKeiQ-0004H5-IL for bug-gnu-emacs@gnu.org; Tue, 22 Sep 2020 05:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Sep 2020 09:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 43558 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org, Stefan Monnier Original-Received: via spool by submit@debbugs.gnu.org id=B.160076736116422 (code B ref -1); Tue, 22 Sep 2020 09:36:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Sep 2020 09:36:01 +0000 Original-Received: from localhost ([127.0.0.1]:57244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kKeiO-0004Gn-Gz for submit@debbugs.gnu.org; Tue, 22 Sep 2020 05:36:01 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:47604) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kKeiM-0004Gf-PY for submit@debbugs.gnu.org; Tue, 22 Sep 2020 05:35:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kKeiM-0001uB-Hw for bug-gnu-emacs@gnu.org; Tue, 22 Sep 2020 05:35:58 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:13791 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1kKeiK-0007VT-EP for bug-gnu-emacs@gnu.org; Tue, 22 Sep 2020 05:35:58 -0400 Original-Received: (qmail 32167 invoked by uid 3782); 22 Sep 2020 09:35:51 -0000 Original-Received: from acm.muc.de (p4fe15d08.dip0.t-ipconnect.de [79.225.93.8]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Tue, 22 Sep 2020 11:35:50 +0200 Original-Received: (qmail 26885 invoked by uid 1000); 22 Sep 2020 09:35:50 -0000 Content-Disposition: inline X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.1; envelope-from=acm@muc.de; helo=mail.muc.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/22 05:35:53 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:188668 Archived-At: 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).