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

From: Alan Mackenzie <[email-masked]>
Date: Thu, 25 Jun 2020 16:33:01 +0000

Hello, Dmitry.

On Wed, Jun 24, 2020 at 21:28:09 +0300, Dmitry Gutov wrote:
> Hi Alan,

> On 24.06.2020 20:43, Alan Mackenzie wrote:

[ .... ]

> > But a substantial delay, involving (I think) analysing the code from
> > BOB each time.  The current working setup has a negligible delay at
> > each buffer change (and, of course, recalculation of cache entries
> > only when required).

> I imagine that would not be a significant problem for the rare cases
> that fill-paragraph is called in a JS region. Considering most of the
> contents in mhtml-mode buffers are not JS code, on average, that should
> tilt the scales in favor of parsing lazily, rather than affecting every
> character insertion.

The current patch does parse lazily.  You want to remove the benefit of
using this cache, no matter how small, for reasons I still can't grasp.
This removal will hurt performance, and possibly cause new bugs to solve.

[ .... ]

> > It sounds like you want to use a facility without initialising it.
> > This feels a bit unreasonable.

> That cache reset at the beginning of js-fill-paragraph could as well 
> re-initialize the cache.

You're misusing the work "initialize" here.  If you initialise a variable
every time you read it, you might as well not have that variable.

[ .... ]

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

> > It works automatically at the moment (with the current patch applied).  I
> > think you're saying again you don't want to be troubled by initialising
> > it.

> It doesn't automatically work in mmm-mode. With my suggestion, it very 
> likely would.

It would work fine with the current patch, together with calls to
initialise the mechanism.  What precisely is the problem in mmm-mode?

[ .... ]

-- 
Alan Mackenzie (Nuremberg, Germany).