Subject: Re: bug#74610: 31.0.50; Submitting mhtml-ts-mode, treesitter alternative to mhtml-mode

From: Vincenzo Pupillo <[email-masked]>
Date: Sun, 09 Feb 2025 22:23:03 +0100

Ciao Juri,

In data domenica 9 febbraio 2025 18:54:27 Ora standard dell’Europa centrale, 
Juri Linkov ha scritto:
> > Ciao Eli,
> > This attached patch is the third version. Adapted to support the latest
> > changes introduced in treesit.el and js.el (as described in bug#75456).
> > @Jury, @Yuan what do you think about this version?
> 
> Thanks for the patch.
> 
> I think we need now clarify the relation
> between mhtml-ts-mode and html-ts-mode.
> 
> For example, currently I added a new function
> 'html-ts-mode--outline-predicate' to html-ts-mode.el.
> Should it be used in mhtml-ts-mode.el as well?
I have to try but I think so, mhtml-ts-mode is declared as derived from html-
ts-mode (although it is not very clear to me how derived modes work). The 
treesit-outline-predicate variable is set by html-ts-mode and mhtml-ts-mode 
inherits the same value. 

> 
> What about other settings?  Should html-ts-mode and mhtml-ts-mode
> always be kept in sync?  Or html-ts-mode should be obsoleted
> when it will be superseded by mhtml-ts-mode?
> 
> Maybe html-ts-mode would be still needed as a separate mode
> to be used as embedded submode in such files as e.g.
> Vue single-file component with *.vue files that contain parts
> from js-ts-mode, css-ts-mode, and html-ts-mode for templates.

I don't know. In general, I think having simple major modes makes it easier to 
build more complex aggregations, rather than having to disable some features 
inherited from complex major modes, as in html-ts-mode: "
 ;; `html-ts-mode' inherits from `html-mode' that sets
  ;; regexp-based outline variables.  So need to restore
  ;; the default values of outline variables to be able
  ;; to use `treesit-outline-predicate' above.
"

Vincenzo