bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Dmitry Gutov
Subject: bug#41897: 28.0.50; JavaScript comment filling with mhtml-mode
Date: Fri, 26 Jun 2020 00:20:07 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0

On 25.06.2020 23:11, Alan Mackenzie wrote:

Sluggish performance isn't about "usually" and 98% of the time; it's
about unusual constellations and the other 2%.

Still, a slow-ish fill-paragraph is nowhere near as bad as, say, slowdown during typing.

Then why not do in mmm-mode what I'm doing in CC Mode, mhtml-mode and
js-mode, i.e. add ad hoc code to handle precisely the case of js-mode?

That would be something every user that configures a submode class using
js-mode have to be aware of. That's not easy to document, or even if we
made sure it's documented, to be sure that users read it.

Are you telling me that mmm-mode couldn't keep a watch out for js-mode,
leaving other libraries untroubled?  Again, the trouble here appears to
arise from using something (a mode) without first initialising it.

Sounds like special-casing js-mode, before-change-functions and this particular function all together. Basically, like a magic constant in the code.

This is ultimately doable, but I'm not sure how to write a patch for it which wouldn't leave me feeling dirty after.

These do seem to be the options: some C core support (though I'm not
clear on the particulars of the proposed design), or switching from
ad-hoc caches to syntax-propertize-function and and associated
syntax-ppss cache.

The syntax-propertize-function approach is poor design.  It restricts the
use of the syntax-table text property too much.  syntax-ppss has had a
troubled history and doesn't do the right thing in narrowed buffers.  It
advertises itself as a magic wand which does everything, but when you've
been enticed into committing your SW to it, you then find out it's less
than magic, and you've got to call ugly functions by hand at strange
times, and are restricted in how and when you can use it.

Despite certain edge cases, I've had a lot of success with it. Both in major modes, and in mmm-mode thanks to it.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]