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: Thu, 24 Sep 2020 10:20:22 +0000 Message-ID: <20200924102022.GA4714@ACM> References: <20200923144824.GD6178@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="12731"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 43558@debbugs.gnu.org, Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 24 12:21:21 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 1kLONN-0003Ci-P0 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Sep 2020 12:21:21 +0200 Original-Received: from localhost ([::1]:59090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLONM-00013G-S3 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Sep 2020 06:21:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51442) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLON4-00010g-BH for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2020 06:21:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55366) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kLON4-0004uz-0i for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2020 06:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kLON3-0001iW-S7 for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2020 06:21:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Sep 2020 10:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43558 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 43558-submit@debbugs.gnu.org id=B43558.16009428346543 (code B ref 43558); Thu, 24 Sep 2020 10:21:01 +0000 Original-Received: (at 43558) by debbugs.gnu.org; 24 Sep 2020 10:20:34 +0000 Original-Received: from localhost ([127.0.0.1]:38679 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kLOMc-0001hS-4k for submit@debbugs.gnu.org; Thu, 24 Sep 2020 06:20:34 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:38429 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1kLOMY-0001h9-CM for 43558@debbugs.gnu.org; Thu, 24 Sep 2020 06:20:33 -0400 Original-Received: (qmail 43336 invoked by uid 3782); 24 Sep 2020 10:20:23 -0000 Original-Received: from acm.muc.de (p4fe15b66.dip0.t-ipconnect.de [79.225.91.102]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Thu, 24 Sep 2020 12:20:22 +0200 Original-Received: (qmail 4728 invoked by uid 1000); 24 Sep 2020 10:20:22 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de 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:188847 Archived-At: Hello, Stefan. On Wed, Sep 23, 2020 at 14:44:54 -0400, Stefan Monnier wrote: > > It seems that as well as the existing variable > > comment-end-can-be-escaped, we need a new one, say > > line-comment-end-can-be-escaped, too. > syntax.c doesn't like to think of it as "line-comment" but rather as > comment stay a, b, c, or nested and non-nested. > > In C and C++ modes, these would be nil and t respectively. > I sm-c-mode, I'd handle those corner cases in > `syntax-propertize-function` (tho I think I don't bother with this one > currently). > So, I guess in CC-mode, you could handle those by placing `syntax-table` > properties from ... wherever you place them ;-) As already said, this is a(n ugly) workaround. syntax.c should handle comments in all their generality. With a bit of consideration, the method to do this is clear: Introduce a new syntax flag `e' which takes effect in comment delimiters. It means "escape characters are active in this type of comment". In a two character delimiter it would, like `b', only take effect on the inner of the two characters. So the syntaxes of the C++ comment characters would be amended to look like / ". 124be" * ". 23" (unchanged) \n "> be" This would be an easy change to make, and (unlike using syntax-table text properties) would cost negligible run time. What do you think? > Stefan -- Alan Mackenzie (Nuremberg, Germany).