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

From: Juri Linkov <[email-masked]>
Date: Mon, 16 Dec 2024 19:37:35 +0200

Ciao Vincenzo,

> In data mercoledì 11 dicembre 2024 05:54:09 Ora standard dell’Europa centrale, 
>
> Attached is the revised patch following your previous comments.
> As I already wrote to Dmitry, I am doing some tests to see if html-ts-mode can 
> be extended and if there is a way to integrate one multi-language mode into 
> another multi-language mode.

I'm testing your patch with mhtml-ts-mode, and everything works nicely.

At the same time I'm adding a new ts-thing named 'sexp-list' in bug#73404.
While 'sexp' defines both lists and atoms, 'sexp-list' defines only lists.

So I added (sexp-list ,(regexp-opt '("element")) 'symbols)
to treesit-thing-settings in html-ts-mode.el.

But then discovered surprisingly that it has no effect on mhtml-ts-mode.

The problem is that treesit-thing-settings should be duplicated
from html-ts-mode to mhtml-ts-mode.
                 
On the one hand, integrating multi-language mode to the exiting mode
html-ts-mode could avoid the need to duplicate treesit-thing-settings
for html.

But on the other hand, integrating mhtml-ts-mode to html-ts-mode
doesn't help to avoid such duplication for other embedded modes.
Because I needed to duplicate treesit-thing-settings for javascript
as well.

So extending html-ts-mode doesn't help here, and maybe even better
to add mhtml-ts-mode to keep the symmetry with existing mhtml-mode
such as used in mode remapping:

  (add-to-list 'major-mode-remap-alist '(mhtml-mode .
                                         mhtml-ts-mode))

What could really help is to try to get settings from html-ts-mode
and js-ts-mode to avoid the need to duplicate settings in mhtml-ts-mode.