unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: "Simen Heggestøyl" <simenheg@runbox.com>,
	acm@muc.de, 41897@debbugs.gnu.org
Subject: bug#41897: 28.0.50; JavaScript comment filling with mhtml-mode
Date: Tue, 23 Jun 2020 19:17:13 +0000	[thread overview]
Message-ID: <20200623191713.GC6957@ACM> (raw)
In-Reply-To: <10235ec5-17c3-c281-b5ed-2c65a07bd02f@yandex.ru>

Hello, Dmitry.

On Tue, Jun 23, 2020 at 20:59:22 +0300, Dmitry Gutov wrote:
> Hi Alan,

> On 23.06.2020 19:28, Alan Mackenzie wrote:

> >> 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.

> But isn't CC Mode confused by chunks of text with a totally different 
> syntax?

It might well be, probably is.  But this isn't CC Mode we're talking
about - just a tiny part of its low level functionality, namely the bit
dealing with literals and filling them.

> >> And there's no way to just "reset" it to an appropriate value?

> > No.  Not without killing its utility as a cache.

> What do you mean? Even if the cache is reset at the beginning of a 
> function, if the function refers to it multiple times, the first time 
> should refill the cache, and the rest of the calls will be able to make 
> use of it properly.

That's what I mean.  The cache persists over commands, reducing the
amount of recalculation needed, particularly for fast typing.  Refilling
it from scratch on every keypress would likely make it sluggish.

Anyhow, it works fine at the moment, so why change it?

[ .... ]

> >> 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.

> js-mode can be one of its submodes. c-mode as well, but none of CC Mode
> family of major modes ever worked okay with it, I think.

Having several major modes in a single buffer has always been problematic
in Emacs.  Personally, I think there needs to be amendments in the
low-level C code to support it properly, but I'm not able to do this work
on my own, and there doesn't seem to be enough enthusiasm on other
people's part to help out.

> js-mode mostly works, aside from features like this one.

With the current patch, comment filling should work fine in js-mode.

> >> 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.

> Hopefully, it would make the submode regions inside independent 
> "islands", so to speak. Each of them having its own cache structure 
> (used or not).

Ah, OK.  So, buffer positions would be offsets from the island start, or
something like that.

> TBH I'm not sure if mhtml-mode does the save-and-restore dance which 
> would be necessary for this. mmm-mode does, though.

mhtml-mode does do saving and restoring of local variables.  I can't
judge how well in comparison with, say, mmm-mode.

-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2020-06-23 19:17 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <874krbaqg3.fsf@simenheg@gmail.com>
     [not found] ` <mailman.1991.1592327403.2541.bug-gnu-emacs@gnu.org>
2020-06-20 17:18   ` bug#41897: 28.0.50; JavaScript comment filling with mhtml-mode Alan Mackenzie
2020-06-20 18:27     ` Simen Heggestøyl
     [not found]     ` <87d05ta8z9.fsf@simenheg@gmail.com>
2020-06-21 16:55       ` Alan Mackenzie
2020-06-22 19:17       ` Alan Mackenzie
2020-06-23  0:02         ` Dmitry Gutov
2020-06-23  8:36           ` Alan Mackenzie
2020-06-23 14:23             ` Dmitry Gutov
2020-06-23 16:28               ` Alan Mackenzie
2020-06-23 17:59                 ` Dmitry Gutov
2020-06-23 19:17                   ` Alan Mackenzie [this message]
2020-06-23 23:11                     ` Dmitry Gutov
2020-06-24 17:43                       ` Alan Mackenzie
2020-06-24 18:28                         ` Dmitry Gutov
2020-06-25 16:33                           ` Alan Mackenzie
2020-06-25 16:48                             ` Dmitry Gutov
2020-06-25 18:07                               ` Alan Mackenzie
2020-06-25 18:19                                 ` Dmitry Gutov
2020-06-25 19:13                                   ` Alan Mackenzie
2020-06-25 19:28                                     ` Dmitry Gutov
2020-06-25 20:11                                       ` Alan Mackenzie
2020-06-25 21:20                                         ` Dmitry Gutov
2020-06-27 11:06                                           ` Alan Mackenzie
2020-06-28  0:18                                             ` Dmitry Gutov
2020-06-25 20:53                     ` Tom Tromey
2020-06-25 21:14                       ` Dmitry Gutov
2020-06-26 16:31                       ` Alan Mackenzie
2020-06-25 20:49         ` Tom Tromey
2020-06-26 16:46           ` Alan Mackenzie
2020-07-04 13:13         ` Alan Mackenzie
2020-06-16 17:08 Simen Heggestøyl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200623191713.GC6957@ACM \
    --to=acm@muc.de \
    --cc=41897@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=simenheg@runbox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).