Variable: treesit-auto-install-grammar

treesit-auto-install-grammar is a customizable variable defined in treesit.el.gz.

Value

ask

Documentation

Whether to install tree-sitter language grammar libraries when needed.

This controls whether Emacs will install missing grammar libraries when they are needed by some tree-sitter based mode.

If always, install the grammar library without asking. If ask, ask for confirmation before installing the grammar library. If ask-dir, ask for confirmation and also for a directory name where to install the grammar library. The selected directory name is then added to the list in treesit-extra-load-path, but not saved, so it's used only within the current session. It's advisable to customize and save treesit-extra-load-path manually.

The default directory for the above three values is the first writeable directory from the list in treesit-extra-load-path. If it's nil, then the grammar is installed to the standard location, the "tree-sitter" directory under user-emacs-directory.

If the value of this variable is nil or never or anything else, don't install the grammar library even while visiting a file in the mode that requires such grammar; this might display a warning and/or fail to turn on the mode.

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

Probably introduced at or before Emacs version 31.1.

Source Code

;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defcustom treesit-auto-install-grammar 'ask
  "Whether to install tree-sitter language grammar libraries when needed.
This controls whether Emacs will install missing grammar libraries
when they are needed by some tree-sitter based mode.

If `always', install the grammar library without asking.
If `ask', ask for confirmation before installing the grammar library.
If `ask-dir', ask for confirmation and also for a directory name where
to install the grammar library.  The selected directory name is then
added to the list in `treesit-extra-load-path', but not saved, so
it's used only within the current session.  It's advisable to
customize and save `treesit-extra-load-path' manually.

The default directory for the above three values is the first writeable
directory from the list in `treesit-extra-load-path'.  If it's nil, then
the grammar is installed to the standard location, the \"tree-sitter\"
directory under `user-emacs-directory'.

If the value of this variable is nil or `never' or anything else, don't
install the grammar library even while visiting a file in the mode that
requires such grammar; this might display a warning and/or fail to turn
on the mode."
  :type '(choice (const :tag "Never install grammar libraries" never)
                 (const :tag "Always automatically install grammar libraries"
                        always)
                 (const :tag "Ask whether to install missing grammar libraries"
                        ask)
                 (const :tag "Ask where to install missing grammar libraries"
                        ask-dir))
  :version "31.1")