GNU bug report logs - #41897
28.0.50; JavaScript comment filling with mhtml-mode

Previous Next

Package: emacs;

Reported by: Simen Heggestøyl <simenheg <at> runbox.com>

Date: Tue, 16 Jun 2020 17:10:01 UTC

Severity: normal

Found in version 28.0.50

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


Message #38 received at 41897 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Simen Heggestøyl <simenheg <at> runbox.com>,
 41897 <at> debbugs.gnu.org
Subject: Re: bug#41897: 28.0.50; JavaScript comment filling with mhtml-mode
Date: Wed, 24 Jun 2020 02:11:31 +0300
On 23.06.2020 22:17, Alan Mackenzie wrote:

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

So this cache is really serving the filling functionality only in this case.

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

Not on every keypress. Only when js-fill-paragraph is called. One-time 
delay only when required.

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

The above scheme would require fewer references to CC Mode functions 
from outside. js-mode support would automatically transfer to mhtml-mode 
and mmm-mode with associated changes in them necessary.

One fewer before-change-functions element is also nothing to sneeze at.

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

We've learned to deal with most other major modes and features in mmm 
context.

>> js-mode mostly works, aside from features like this one.
> 
> With the current patch, comment filling should work fine in js-mode.

Above, I meant that js-mode mostly works fine with mmm-mode. And my 
suggestion might make comment filling work there, too. Automatically.

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

Not necessarily, but possibly. The key aspect is that the cache inside a 
particular submode is not affected by user actions outside of its 
bounds. Not directly, at least.

But that's an mmm-mode feature anyway.




This bug report was last modified 5 years and 42 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.