GNU bug report logs -
#41897
28.0.50; JavaScript comment filling with mhtml-mode
Previous Next
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 #23 received at 41897 <at> debbugs.gnu.org (full text, mbox):
Hello, Dmitry.
On Tue, Jun 23, 2020 at 03:02:48 +0300, Dmitry Gutov wrote:
> Hi Alan,
> On 22.06.2020 22:17, Alan Mackenzie wrote:
> > +(defun c-foreign-truncate-lit-pos-cache (beg _end)
> > + "Truncate CC Mode's literal cache.
> > +
> > +This function should be added to the `before-change-functions'
> > +hook by major modes that use CC Mode's filling functionality
> > +without initializing CC Mode. Currently (2020-06) these are
> > +js-mode and mhtml-mode."
> > + (c-truncate-lit-pos-cache beg))
> Could you explain this part?
> Is that literal cache looked up once during filling, or is it used
> multiple times during the execution of c-fill-paragraph?
It's used several times during each filling operation. This cache
persists between commands, too.
> 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.
> 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.
--
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.