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

From: Alan Mackenzie <[email-masked]>
Date: Fri, 26 Jun 2020 16:46:02 +0000

Hello, Tom.

On Thu, Jun 25, 2020 at 14:49:57 -0600, Tom Tromey wrote:
> >>>>> "Alan" == Alan Mackenzie <[email-masked]> writes:

> Alan> (ii) An enhancement to CC Mode, used by mhtml-mode and js-mode, which
> Alan> invalidates a CC Mode cache used by the filling code.  This gets rid of
> Alan> a few strange looking bugs;

> I wonder if js-mode can be changed not to use cc-mode like this.

The main filling function in CC Mode is 390 lines long.  It deals with
lots of special cases, like comment markers being or not being on lines
by themselves, and so on.  It's understandable to want to reuse it rather
than copying it into a js-... function.

> Looking at js.el, it seems like this is the origin of a use of advice
> in-core, which is generally frowned upon:

>     ;; FIXME: Such redefinitions are bad style.  We should try and use some other
>     ;; way to get the same result.
>     (defun js--fill-c-advice (js-fun)
>     ...

Funnily enough, as CC Mode maintainer, I don't find this artifice
particularly objectionable.  Advice has its uses, even in the core.

> Tom

-- 
Alan Mackenzie (Nuremberg, Germany).