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 #29 received at 41897 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Dmitry Gutov <dgutov <at> yandex.ru>
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: Tue, 23 Jun 2020 16:28:37 +0000
Hello, Dmitry.

On Tue, Jun 23, 2020 at 17:23:53 +0300, Dmitry Gutov wrote:
> On 23.06.2020 11:36, Alan Mackenzie wrote:

> >> If the latter (and it does serve as a cache this way), perhaps it
> >> could be cleared once, at the beginning of c-fill-paragraph, instead
> >> of adding a runtime cost to every edit?

> > The cost is tiny.  c-truncate-lit-pos-cache is a defsubst which does
> > nothing but three copies of

> >      (setq cache-limit (min beg cache-limit))

> > .  All the intricacies of manipulating the cache take place whilst it
> > is being used.

> >> Or if that's undesirable, js-fill-paragraph could do that.

> > No, it really has to be in a before-change-functions function, to
> > keep track of the bound of the valid cache.

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

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

No.  Not without killing its utility as a cache.

> >> This way, I think it would automatically make it compatible with
> >> mmm-mode. Or at least more compatible.

> > Maybe putting the two c-foreign-* functions into mmm-mode would work.

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

> And its configurations don't usually result in new major modes either.

> I wouldn't say it's very hard to make it work, but I don't see a "neat" 
> way to do either.

OK.

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

-- 
Alan Mackenzie (Nuremberg, Germany).




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.