Subject: bug#74339: 30.0.92; CC Mode stomps C TS Mode

From: Eli Zaretskii <[email-masked]>
Date: Fri, 15 Nov 2024 09:58:52 +0200

> From: Stefan Monnier <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Thu, 14 Nov 2024 15:58:49 -0500
> 
> >> >> Not quite: `auto-mode-alist` should always map `.c` files to `c-mode`.
> >> > Why "always"?
> >> 
> >> Because the preference between `c-mode` and `c-ts-mode` should apply not
> >> only to those files whose mode is decided by `auto-mode-alist` but also
> >> to those where this is decided via other means such as via a file-local
> >> `mode` setting, or via `magic-mode-alist`, or ...
> >
> > You assume that people will always want to remap all of those to the
> > same mode?
> 
> Not always but in the vast majority of cases, yes.
> 
> > And that no one will ever want to have, say, files with the -*- c -*-
> > cookie to use c-mode and nothing else?  Some might, even if the
> > majority won't.
> 
> Those few who want that can still get it: just config
> `major-mode-remap-alist` to remap `c-mode` to `c-mode` (or to nil), and
> then things work as if `major-mode-remap-*` didn't exist: `-*- c -*-`
> will mean to use CC-mode's `c-mode` and `-*- c-ts -*-` will use
> `c-ts-mode`.

This will cause Emacs to visit C files without the cookie in c-mode.
What I meant was an (admittedly somewhat strange) preference to visit
C files without a cookie in c-ts-mode, but files that have a cookie in
the mode called out by the cookie.  AFAIU, major-mode-remap-*
variables cannot handle this distinction, at least not currently.