On Aug 26, 2023, at 1:59 PM, Eshel Yaron <me@eshelyaron.com> wrote:
I think the last sentence is a slight over simplification: even before
`foo-ts-mode`s, Emacs didn't have a clean abstraction for a (programming
language) AFAICT, only major modes. And "competing" major modes for the
same language are not a new problem. So these "consumer modes" would
have to be more clever and, hopefully, already have the right methods in
place to deal with the existence of multiple major modes per language.
(Admittedly, `foo-ts-mode`s make this challenge much more pronounced.)
Looking at the specific examples you mentioned: Org mode handles this
well with `org-src-lang-modes`, which is quite more sophisticated than
just reaching out for `LANG-mode`. (BTW in `sweeprolog.el` there's a
similar mechanism for highlighting quasi-
org-src-lang-modes
¶If an Emacs major-mode named <LANG>-mode exists
, where <LANG> is the language identifier from code block’s header line, then the edit buffer uses that major mode.