From: Dmitry Gutov <dgutov@yandex.ru>
To: Alan Mackenzie <acm@muc.de>
Cc: "Simen Heggestøyl" <simenheg@runbox.com>, 41897@debbugs.gnu.org
Subject: bug#41897: 28.0.50; JavaScript comment filling with mhtml-mode
Date: Wed, 24 Jun 2020 21:28:09 +0300 [thread overview]
Message-ID: <ef02c8cb-cb83-3b9d-ddd6-da4ee428e684@yandex.ru> (raw)
In-Reply-To: <20200624174333.GA8870@ACM>
Hi Alan,
On 24.06.2020 20:43, Alan Mackenzie wrote:
>>> 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.
>
> 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.
>>> 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.
>
> 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.
>> One fewer before-change-functions element is also nothing to sneeze at.
>
> There's nothing wrong with having functions in
> before/after-change-functions. It's a standard Emacs programming
> technique.
I'm not saying it's a terrible idea, but it has its downsides.
>>>> 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.
>>>>>> 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.
>
> Well, when a cached holds buffer positions, something has to give -
> either markers need to be used, or an offset from a variable position, or
> something.
Makes sense. The alternative would be to index the positions from the
beginning of the submode region. But then the related feature must
respect narrowing, and it would require explicit integration from
mmm-mode and friends.
next prev parent reply other threads:[~2020-06-24 18:28 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <874krbaqg3.fsf@simenheg@gmail.com>
[not found] ` <mailman.1991.1592327403.2541.bug-gnu-emacs@gnu.org>
2020-06-20 17:18 ` bug#41897: 28.0.50; JavaScript comment filling with mhtml-mode Alan Mackenzie
2020-06-20 18:27 ` Simen Heggestøyl
[not found] ` <87d05ta8z9.fsf@simenheg@gmail.com>
2020-06-21 16:55 ` Alan Mackenzie
2020-06-22 19:17 ` Alan Mackenzie
2020-06-23 0:02 ` Dmitry Gutov
2020-06-23 8:36 ` Alan Mackenzie
2020-06-23 14:23 ` Dmitry Gutov
2020-06-23 16:28 ` Alan Mackenzie
2020-06-23 17:59 ` Dmitry Gutov
2020-06-23 19:17 ` Alan Mackenzie
2020-06-23 23:11 ` Dmitry Gutov
2020-06-24 17:43 ` Alan Mackenzie
2020-06-24 18:28 ` Dmitry Gutov [this message]
2020-06-25 16:33 ` Alan Mackenzie
2020-06-25 16:48 ` Dmitry Gutov
2020-06-25 18:07 ` Alan Mackenzie
2020-06-25 18:19 ` Dmitry Gutov
2020-06-25 19:13 ` Alan Mackenzie
2020-06-25 19:28 ` Dmitry Gutov
2020-06-25 20:11 ` Alan Mackenzie
2020-06-25 21:20 ` Dmitry Gutov
2020-06-27 11:06 ` Alan Mackenzie
2020-06-28 0:18 ` Dmitry Gutov
2020-06-25 20:53 ` Tom Tromey
2020-06-25 21:14 ` Dmitry Gutov
2020-06-26 16:31 ` Alan Mackenzie
2020-06-25 20:49 ` Tom Tromey
2020-06-26 16:46 ` Alan Mackenzie
2020-07-04 13:13 ` Alan Mackenzie
2020-06-16 17:08 Simen Heggestøyl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ef02c8cb-cb83-3b9d-ddd6-da4ee428e684@yandex.ru \
--to=dgutov@yandex.ru \
--cc=41897@debbugs.gnu.org \
--cc=acm@muc.de \
--cc=simenheg@runbox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).