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: Thu, 25 Jun 2020 20:11:00 +0000 Message-ID: <20200625201100.GE10342@ACM> References: <20200623191713.GC6957@ACM> <4c6a9c40-a72c-1413-4e08-c7097f8bc407@yandex.ru> <20200624174333.GA8870@ACM> <20200625163301.GA10342@ACM> <20200625180722.GC10342@ACM> <20200625191359.GD10342@ACM> <70532224-5beb-b311-648c-fda352de88cb@yandex.ru> 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="72922"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Simen =?UTF-8?Q?Heggest=C3=B8yl?= , acm@muc.de, 41897@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 25 22:14:45 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 1joYGj-000Ir2-B7 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 25 Jun 2020 22:14:45 +0200 Original-Received: from localhost ([::1]:58142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1joYGi-0002YR-Dn for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 25 Jun 2020 16:14:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60992) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1joYE6-00084N-7k for bug-gnu-emacs@gnu.org; Thu, 25 Jun 2020 16:12:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57923) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1joYE5-0008Fj-UG for bug-gnu-emacs@gnu.org; Thu, 25 Jun 2020 16:12:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1joYE5-0000jb-O7 for bug-gnu-emacs@gnu.org; Thu, 25 Jun 2020 16:12: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, 25 Jun 2020 20:12:01 +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.15931158732767 (code B ref 41897); Thu, 25 Jun 2020 20:12:01 +0000 Original-Received: (at 41897) by debbugs.gnu.org; 25 Jun 2020 20:11:13 +0000 Original-Received: from localhost ([127.0.0.1]:41236 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1joYDJ-0000iZ-Lf for submit@debbugs.gnu.org; Thu, 25 Jun 2020 16:11:13 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:31845 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1joYDD-0000i6-PU for 41897@debbugs.gnu.org; Thu, 25 Jun 2020 16:11:12 -0400 Original-Received: (qmail 325 invoked by uid 3782); 25 Jun 2020 20:11:01 -0000 Original-Received: from acm.muc.de (p4fe15761.dip0.t-ipconnect.de [79.225.87.97]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Thu, 25 Jun 2020 22:10:59 +0200 Original-Received: (qmail 31931 invoked by uid 1000); 25 Jun 2020 20:11:00 -0000 Content-Disposition: inline In-Reply-To: <70532224-5beb-b311-648c-fda352de88cb@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:182391 Archived-At: Hello, Dmitry. On Thu, Jun 25, 2020 at 22:28:17 +0300, Dmitry Gutov wrote: > On 25.06.2020 22:13, Alan Mackenzie wrote: > >> That's unfortunate. > > Indeed. Let's assume that keeping it working is a requirement here. > Still, buffers that user mixed modes are usually not so big as some of > the files we have in src/*.c. So even forgoing caching might result in > a satisfying user experience 98% of the time. Sluggish performance isn't about "usually" and 98% of the time; it's about unusual constellations and the other 2%. [ .... ] > >> If it did, though, it would only call your before-change-functions > >> inside js-mode regions, but it would have ignored them in HTML and CSS > >> regions. Which doesn't appear to be what you want anyway. > > Then why not do in mmm-mode what I'm doing in CC Mode, mhtml-mode and > > js-mode, i.e. add ad hoc code to handle precisely the case of js-mode? > That would be something every user that configures a submode class using > js-mode have to be aware of. That's not easy to document, or even if we > made sure it's documented, to be sure that users read it. Are you telling me that mmm-mode couldn't keep a watch out for js-mode, leaving other libraries untroubled? Again, the trouble here appears to arise from using something (a mode) without first initialising it. > >>> There's no problem with before/after-change-functions. They're the > >>> canonical way to react to buffer changes. > >> They're not very manageable, from mmm's point of view. And like the > >> current example shows, it's not obvious what to do with such hooks > >> outside of submode regions of major modes that added them. > > Like I said earlier on in the thread, making several major modes in a > > buffer work is problematic in Emacs, and we really want better > > support from the C core for it. Here we seem to want "global" and > > "mode-local" before-change-functionses. > These do seem to be the options: some C core support (though I'm not > clear on the particulars of the proposed design), or switching from > ad-hoc caches to syntax-propertize-function and and associated > syntax-ppss cache. The syntax-propertize-function approach is poor design. It restricts the use of the syntax-table text property too much. syntax-ppss has had a troubled history and doesn't do the right thing in narrowed buffers. It advertises itself as a magic wand which does everything, but when you've been enticed into committing your SW to it, you then find out it's less than magic, and you've got to call ugly functions by hand at strange times, and are restricted in how and when you can use it. -- Alan Mackenzie (Nuremberg, Germany).