bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Juri Linkov
Subject: bug#60176: 29.0.60; Fallback file variable mode if treesitter is not usable
Date: Tue, 10 Jan 2023 20:08:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

>>     (setq (alist-get 'c-mode major-mode-remap-alist)
>>           (lambda () (if (treesit-available-p) (c-ts-mode) (c-mode))))
>
> 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.

Shouldn't we help users by simplifying such complex customization
and provide a customizable list of modes where tree-sitter is enabled,
e.g.

(defcustom treesit-enable-modes nil
  :type '(repeat
          (choice (function-item c-ts-mode)
                  (function-item c++-ts-mode)
                  (function-item c-or-c++-ts-mode)
                  ...
  :initialize #'custom-initialize-default
  :set (lambda (sym val)
         (set-default sym val)
         (dolist (mode treesit-enable-modes)
           (pcase mode
             ('c-ts-mode
              (when (treesit-ready-p 'c t)
                (add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))))
             ...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]