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

From: Eli Zaretskii <[email-masked]>
Date: Fri, 05 Jan 2024 15:26:00 +0200

> From: João Távora <[email-masked]>
> Date: Fri, 5 Jan 2024 11:27:53 +0000
> Cc: [email-masked], [email-masked]
> 
> base-foo-mode is a natural place for setup that is common
> to both foo-mode and foo-ts-mode to exist.  There is a
> good number of things that are independent of the particular
> implementation of parsing (lisp-based vs ts-based).
> 
> Is it too late for the ts-modes to be looked at like that?

It doesn't always make sense.  Where it does make sense, I think we
did it (see python-ts-mode, for example).

> It seems our approach to TS modes often/always looks like
> 'foo-rewrite-completely-using-ts-while-at-it-mode'.

That's right -- but it's justified.  The commonality is usually either
very thin or almost non-existent.  If you think about it, you will
understand: where the traditional modes use regexps and syntax-pss,
the TS modes use parser-related primitives.  How can you find common
grounds between these so different bases for implementation?

> > It should modify our .dir-locals.el and Eglot's database to
> > remove special entries for TS modes
> 
> As Dmitry mentioned: if that is done just like that it will
> break Eglot's support of ts modes in any Emacs which doesn't
> have Stefan's patch.

Then Eglot (or maybe compat.el) will have to provide compatibility
shims.  But for .dir-locals.el, I still think we should update it.

> Also, I know this mail is long enough, but apropos Eglot's
> database, it's getting quite large as you may notice.  Another,
> much more natural way to simplify it would be, if major-modes
> started setting eglot-server-program (singular) buffer-locally
> variable which takes precedence over eglot-server-programs.

Maybe.  But that's an unrelated issue.