Subject: bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable

From: Eli Zaretskii <[email-masked]>
Date: Tue, 10 Jan 2023 14:55:08 +0200

> From: Stefan Monnier <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,  [email-masked],  [email-masked]
> Date: Mon, 09 Jan 2023 18:06:17 -0500
> 
> >> The current syntax is rather
> >>
> >>     (setq major-mode-remap-alist '((c-mode . treesit-available-p c-ts-mode)))
> >
> > Is it possible at least to make this forward-compatible to support
> > such a predicate in future?  To enable ts-modes only in some buffers
> > currently requires first to enable non-ts-mode, then conditionally ts-mode:
> 
> We can use:
> 
>     (setq (alist-get 'c-mode major-mode-remap-alist)
>           (lambda () (if (treesit-available-p) (c-ts-mode) (c-mode))))

Who is "we" here?

I don't want to do this by default, because we want users of Emacs 29
to turn on TS modes manually, if and when they want that and think
they are ready.

Of course, I don't mind if the above is done in local customizations
by users who are willing to use TS modes whenever they become
available.