Subject: Re: bug#68246: 30.0.50; Add non-TS mode as extra parent of TS modes

From: João Távora <[email-masked]>
Date: Mon, 8 Jan 2024 10:50:57 +0000

On Mon, Jan 8, 2024 at 3:34 AM Eli Zaretskii <[email-masked]> wrote:

> That's not useful, since, for example, TS and non-TS mods for those
> "no-language" modes will still want to be treated the same in some
> situations, like .dir-locals.el.

Yup, so pass them same :language to them and call `get-language-for-mode`
somewhere in the .dir-locals.el machinery?  Else suggest to use the base mode,
if it exists.  If it doesn't exist, create it?

> It attempts to abstract a trait that isn't abstract, by going in the
> opposite direction of that used for abstractions.

It's interesting how you state a simple get/set is a "leaky abstraction",
but then also not an abstraction at all.

Let's put it like this:  Eglot should probably fix this actual code:

   (replace-regexp-in-string "\\(?:-ts\\)?-mode$" "" (symbol-name sym))

to find the language to report to the server.  Users should also be relieved
to write or read :languageId in complicated fashion in eglot-server-programs.

Stefan's doesn't really address this.  Fine.  But it _will_ affect
eglot-server-programs.  In fact someone (TM) should come up with a docstring
change to e-s-p that at least hints at this concept of "extra parents",
since it will start taking effect immediately for some modes, for some
Emacs versions.

What if an Eglot users wants some server just for the non-TS mode?  Or a
Yasnippet user some snippets for such a mode?  Or even just regular
user some directory-local variable value?

The fact is that Eglot users, who are sometimes are surprised by mode
inheritance as it is will see a more complicated concept come
into force (in some Emacs versions, not all).  This concept will apply
to the python-mode/python-ts-mode pair but not the
clojure-mode/clojure-ts-mode one.

The following becomes harder to decipher:

   (add-to-list 'eglot-server-programs (foo-mode "Fooey" "stdio"))

It may or may not go together with the typical:

   (add-hook 'foo-mode-hook 'my-foo-eglot-config)

depending on whether the user has Stefan's patch, whether it patches
"foo-ts-mode" and depending on the mode the user is running.

The more I think about this, the more I think this is problematic.

But if you guys are so confident, sure, let's try it.  If nothing bad
happens great, else I guess I'll refer users to this thread.

João