Subject: Re: bug#41897: 28.0.50; JavaScript comment filling with mhtml-mode

From: Alan Mackenzie <[email-masked]>
Date: Fri, 26 Jun 2020 16:31:46 +0000

Hello, Tom.

On Thu, Jun 25, 2020 at 14:53:44 -0600, Tom Tromey wrote:
> >>>>> "Alan" == Alan Mackenzie <[email-masked]> writes:

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

> mhtml-mode was a stab at making this work.  It does require some more
> changes in Emacs (there's another bug open about font-lock that requires
> some changes to the font-lock code, but there are also a few more I
> could list), but I didn't come across anything requiring C changes.

> What changes are you thinking of?

In 2016, I came up with a preliminary, but detailed, design for
"islands" which would make several major modes per buffer natively and
naturally supported, without awkward workarounds.  This included
"island-local" variables to supplement buffer-local variables.  All this
would be implemented at the C level and would obviate the awkward
pre/post-command-hook functions currently used by mhtml-mode for
swapping in and out the buffer local variables.

The post to emacs-devel which started the discussion was:
Subject: A vision for multiple major modes: some design notes
To: [email-masked], Dmitry Gutov <[email-masked]>
Date: Wed, 20 Apr 2016 19:44:50 +0000

Although interest was expressed, in the end there was nobody else
jumping up shouting "hey, that's great!  Can I help?" (not that I
specifically asked for help), so the idea didn't advance beyond that
preliminary design.  I still think that parts of it could be helpful in
mmm-mode (or its successor).

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

> It does.  Whatever happened to the idea of pulling mmm into Emacs core?
> Maybe we could get rid of mhtml-mode.

> Tom

-- 
Alan Mackenzie (Nuremberg, Germany).