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: Sun, 22 Nov 2020 22:01:10 +0000 Message-ID: <20201122220110.GI5912@ACM> References: <20201119211822.GE6259@ACM> <20201122131231.GB5912@ACM> <20201122170830.GD5912@ACM> <20201122181957.GF5912@ACM> <73ccc858-dd03-248f-4b89-5679a8f3cd63@yandex.ru> <20201122211353.GH5912@ACM> <00dc580c-3b48-c185-9020-2cb2b7528884@yandex.ru> 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="33969"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 43558@debbugs.gnu.org, Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , Stefan Monnier To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 22 23:02:14 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 1kgxQz-0008ic-Ob for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 Nov 2020 23:02:13 +0100 Original-Received: from localhost ([::1]:39934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kgxQy-000848-Rh for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 Nov 2020 17:02:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59864) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kgxQo-00083n-PC for bug-gnu-emacs@gnu.org; Sun, 22 Nov 2020 17:02:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36919) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kgxQo-0005PY-CC for bug-gnu-emacs@gnu.org; Sun, 22 Nov 2020 17:02:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kgxQo-0000eJ-8S for bug-gnu-emacs@gnu.org; Sun, 22 Nov 2020 17:02:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 22 Nov 2020 22:02:02 +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.16060824812441 (code B ref 43558); Sun, 22 Nov 2020 22:02:02 +0000 Original-Received: (at 43558) by debbugs.gnu.org; 22 Nov 2020 22:01:21 +0000 Original-Received: from localhost ([127.0.0.1]:48465 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kgxQ9-0000dJ-Dg for submit@debbugs.gnu.org; Sun, 22 Nov 2020 17:01:21 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:42684 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1kgxQ5-0000d3-KK for 43558@debbugs.gnu.org; Sun, 22 Nov 2020 17:01:19 -0500 Original-Received: (qmail 89144 invoked by uid 3782); 22 Nov 2020 22:01:11 -0000 Original-Received: from acm.muc.de (p2e5d52bc.dip0.t-ipconnect.de [46.93.82.188]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Sun, 22 Nov 2020 23:01:10 +0100 Original-Received: (qmail 13230 invoked by uid 1000); 22 Nov 2020 22:01:10 -0000 Content-Disposition: inline In-Reply-To: <00dc580c-3b48-c185-9020-2cb2b7528884@yandex.ru> 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:193883 Archived-At: Hello, Dmitry. On Sun, Nov 22, 2020 at 23:34:18 +0200, Dmitry Gutov wrote: > Hi Alan, > On 22.11.2020 23:13, Alan Mackenzie wrote: > > Coding up the Ruby block comments in syntax.c would involve string > > comparisons, for example, and would be an entirely new flavour > > inside that file. It would involve examining individual letters > > rather than just their syntax. > It could be made to support a new syntax using a finite state machine, > something like that. And the strings could be converted to such by the > major mode. But you're right, it would be more difficult. > > By contrast, coding up the escaped NL in syntax.c was > > straightforward and natural. > > Have you looked at the patch? > Yup. > It's not terrible, but it's still a bunch of new if/elses that one > would need to grasp to maintain that code. It's character, the general use of ifs/elses, and so on, is unchanged. Only somebody with a very detailed memory of exact statements would be inconvenienced, and that only slightly. > >>> Presumably ruby-mode handles these with syntax-table text > >>> properties applied to the = sign and the terminating d, which is a > >>> little clumsy, but not too bad, at the Lisp level. > >> This is just two more regexps to search for (and propertize). I > >> don't expect that the slowdown from them is in any way perceptible. > >> And the general point is that the Emacs syntax table structure > >> doesn't necessarily have to mirror the syntax of the C language. > > Maybe not, but the point remains, that for this fix, a fix at the C > > level is objectively better than a fix at the Lisp level. > > Furthermore, the C level change is already implemented and has been > > well tested. > Why is it objectively better? It's faster, and it avoids fragmenting the handling of CC Mode comments between C and Lisp the way that of strings, for example, has been. It provides a mechanism which might be useful to other major modes in the future. > With user experience (speed, latencies, etc) being equal or within the > margin of error, I think it's more logical to go with simpler data > structures and low level APIs. Fixing things in syntax.c was simpler than a Lisp solution using syntax-table text properties would have been. > Finally, as I recall you feel strongly about supporting older Emacs > versions, a significant number of them. Doing that fix in Lisp would > allow you to fix the bug for those versions too. Not just Emacs 28+. Yes. That appears to be the sole drawback of the fix being in syntax.c. -- Alan Mackenzie (Nuremberg, Germany).