Subject: bug#69191: 30.0.50; New var `major-mode-remap-defaults`, for packages

From: Stefan Monnier <[email-masked]>
Date: Sun, 03 Mar 2024 23:25:27 -0500

>> There are some FIXMEs that one might want to address, most importantly
>> whether we should use an indirection through `major-mode-remap-defaults`
>> for all TS modes or only for those for which we provide a non-TS mode.
>
> My gut says: we shouldn't add out-of-tree modes (e.g. go-mode) to
> auto-mode-alist (they should and already do that themselves); and so
> long as TS modes are viewed as an optional alternative, then they should
> be responsible for setting up major-mode-remap-defaults (so it should be
> a no-op if they remap from an out-of-tree mode that is not installed).

I like the idea of using `go-mode` as the canonical mode, even if we
don't provide it.  But I left this part unchanged for now.

>> +  (let ((mode
>> +         (if (save-excursion
>> +               (save-restriction
>> +                 (save-match-data       ; Why `save-match-data'?
>> +                   (widen)
>> +                   (goto-char (point-min))
>> +                   (re-search-forward c-ts-mode--c-or-c++-regexp nil t))))
>> +             'c++-ts-mode)
>> +         'c-ts-mode))
> I'm excited for this new let-syntax to catch on, but maybe as a separate
> feature request.

You think you're funny. eh?

>> -;;;###autoload (defalias 'TeX-mode #'tex-mode)
>> -;;;###autoload (defalias 'plain-TeX-mode #'plain-tex-mode)
>> -;;;###autoload (defalias 'LaTeX-mode #'latex-mode)
>> +;;;###autoload (add-to-list 'major-mode-remap-defaults '(TeX-mode . tex-mode))
>> +;;;###autoload (add-to-list 'major-mode-remap-defaults '(plain-TeX-mode . plain-tex-mode))
>> +;;;###autoload (add-to-list 'major-mode-remap-defaults '(LaTeX-mode . latex-mode))
>
> Can we really afford to lose the aliases in loaddefs.el?
> There are at least a few in-tree uses of the AUCTeX names.

Oops, indeed.  Hmm... too bad, it means we still have to keep those
aliases a while longer.

        Stefan