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

From: Stefan Monnier <[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))))

-- Stefan