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: Tue, 9 Jan 2024 01:31:25 +0000

On Tue, Jan 9, 2024 at 1:10 AM Dmitry Gutov <[email-masked]> wrote:

> Perhaps we should have entries like ("\\.js\\'" . 'js-lang) in
> auto-mode-alist and then map the symbol to the specific major mode in
> major-mode-remap-alist. But for this to be useful to determine the
> language of a major mode via reverse lookup, all/most programming
> language modes will need to be featured there, rather than this being
> optional and used only for custom overrides.

That clarifies how it would be used, thanks.  But in addition to the
problem you note, there's the fact we would have many new foo-lang
functions and the cdr of that m-m-r-alist is specified to be a function
object, while  major-mode is supposed to be symbol, so a bit brittle
for  reverse lookup.

The simplest way to do that reverse mapping is still just adding an
optional entry to a mode symbol's plist.