Variable: treesit-enabled-modes

treesit-enabled-modes is a customizable variable defined in treesit.el.gz.

Value

nil

Documentation

Specify which tree-sitter based major modes to enable by default.

The value can be either a list of ts-modes to enable, or t to enable all ts-modes. The value nil (the default) means not to enable any tree-sitter based modes.

Enabling a tree-sitter based mode means that visiting files in the corresponding programming language will automatically turn on that mode, instead of any non-tree-sitter based modes for the same language.

This variable was added, or its default value changed, in Emacs 31.1.

View in manual

Probably introduced at or before Emacs version 31.1.

Source Code

;; Defined in /usr/src/emacs/lisp/treesit.el.gz
;;; Treesit enabled modes

;;;###autoload
(defcustom treesit-enabled-modes nil
  "Specify which tree-sitter based major modes to enable by default.
The value can be either a list of ts-modes to enable,
or t to enable all ts-modes.  The value nil (the default)
means not to enable any tree-sitter based modes.

Enabling a tree-sitter based mode means that visiting files in the
corresponding programming language will automatically turn on that
mode, instead of any non-tree-sitter based modes for the same
language."
  :type `(choice
          (const :tag "Disable all tree-sitter modes" nil)
          (const :tag "Enable all available tree-sitter modes" t)
          (set :tag "Enable specific tree-sitter modes"
               ,@(when (treesit-available-p)
                   (sort (mapcar (lambda (m) `(function-item ,m))
                                 (seq-uniq (mapcar #'cdr treesit-major-mode-remap-alist)))))))
  :initialize #'custom-initialize-default
  :set (lambda (sym val)
         (set-default sym val)
         (when (treesit-available-p)
           (dolist (m treesit-major-mode-remap-alist)
             (if (or (eq val t) (memq (cdr m) val))
                 (add-to-list 'major-mode-remap-alist m)
               (setq major-mode-remap-alist
                     (delete m major-mode-remap-alist))))))
  :version "31.1")