From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#41897: 28.0.50; JavaScript comment filling with mhtml-mode Date: Tue, 23 Jun 2020 16:28:37 +0000 Message-ID: <20200623162837.GB6957@ACM> References: <20200620171827.7855.qmail@mail.muc.de> <87d05ta8z9.fsf@simenheg@gmail.com> <20200622191750.GA11506@ACM> <20200623083613.GA6957@ACM> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="12258"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Simen =?UTF-8?Q?Heggest=C3=B8yl?= , 41897@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 23 18:29: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 1jnlnQ-00037Q-5J for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Jun 2020 18:29:16 +0200 Original-Received: from localhost ([::1]:37682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnlnP-0004Jr-09 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Jun 2020 12:29:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnlnC-0004Jb-MO for bug-gnu-emacs@gnu.org; Tue, 23 Jun 2020 12:29:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53708) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jnlnC-00057L-CI for bug-gnu-emacs@gnu.org; Tue, 23 Jun 2020 12:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jnlnC-0001oN-9j for bug-gnu-emacs@gnu.org; Tue, 23 Jun 2020 12:29: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, 23 Jun 2020 16:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41897 X-GNU-PR-Package: emacs Original-Received: via spool by 41897-submit@debbugs.gnu.org id=B41897.15929297286944 (code B ref 41897); Tue, 23 Jun 2020 16:29:02 +0000 Original-Received: (at 41897) by debbugs.gnu.org; 23 Jun 2020 16:28:48 +0000 Original-Received: from localhost ([127.0.0.1]:37021 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jnlmy-0001nw-CL for submit@debbugs.gnu.org; Tue, 23 Jun 2020 12:28:48 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:34427 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1jnlmv-0001ng-0L for 41897@debbugs.gnu.org; Tue, 23 Jun 2020 12:28:46 -0400 Original-Received: (qmail 12565 invoked by uid 3782); 23 Jun 2020 16:28:38 -0000 Original-Received: from acm.muc.de (p4fe157be.dip0.t-ipconnect.de [79.225.87.190]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Tue, 23 Jun 2020 18:28:37 +0200 Original-Received: (qmail 11258 invoked by uid 1000); 23 Jun 2020 16:28:37 -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:182320 Archived-At: Hello, Dmitry. On Tue, Jun 23, 2020 at 17:23:53 +0300, Dmitry Gutov wrote: > On 23.06.2020 11:36, Alan Mackenzie wrote: > >> If the latter (and it does serve as a cache this way), perhaps it > >> could be cleared once, at the beginning of c-fill-paragraph, instead > >> of adding a runtime cost to every edit? > > The cost is tiny. c-truncate-lit-pos-cache is a defsubst which does > > nothing but three copies of > > (setq cache-limit (min beg cache-limit)) > > . All the intricacies of manipulating the cache take place whilst it > > is being used. > >> Or if that's undesirable, js-fill-paragraph could do that. > > No, it really has to be in a before-change-functions function, to > > keep track of the bound of the valid cache. > So it's really fine if it's called from HTML/CSS hunks as well? Not only fine, but necessary. The literal cache contains entries that record things like "C comment between positions 23 and 130". If somebody inserts text before that comment, or inside of it, that cache entry is no longer valid, and must be invalidated. Hence the necessity of the before-change function. > And there's no way to just "reset" it to an appropriate value? No. Not without killing its utility as a cache. > >> This way, I think it would automatically make it compatible with > >> mmm-mode. Or at least more compatible. > > Maybe putting the two c-foreign-* functions into mmm-mode would work. > mmm-mode is a minor mode, it doesn't always deal with CC Mode. The question to consider here is whether any sub-mode of mmm-mode uses CC Mode's comment filling without initialising CC Mode. js-mode and mhtml-mode do this. > And its configurations don't usually result in new major modes either. > I wouldn't say it's very hard to make it work, but I don't see a "neat" > way to do either. OK. > Have you considered adding variables that hold the cache to > mhtml--crucial-variable-prefix as well? Would that make it work? Not without the before-change function, no. I'm trying to see what the point of putting these variables into mhtml's crucial variables would be. -- Alan Mackenzie (Nuremberg, Germany).