summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorYuan Fu <casouri@gmail.com>2026-05-18 20:56:10 -0700
committerYuan Fu <casouri@gmail.com>2026-05-23 22:10:34 -0700
commit4c55d04ebe31f2a84273dfa2f765ca02e18ffb9d (patch)
tree587a0d842efa9e94a2ea75cef63cc751cb16ac28 /lisp/textmodes
parent7892ae5eaf4c22a3209a8c44c6267004653c5691 (diff)
Add treesit-ready-p check back to tree-sitter major modes (bug#80909)
* lisp/progmodes/c-ts-mode.el (c-ts-mode): (c++-ts-mode): * lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode): * lisp/progmodes/dockerfile-ts-mode.el (dockerfile-ts-mode): * lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode): * lisp/progmodes/go-ts-mode.el (go-ts-mode): (go-mod-ts-mode): (go-work-ts-mode): * lisp/progmodes/heex-ts-mode.el (heex-ts-mode): * lisp/progmodes/js.el (js-ts-mode): * lisp/progmodes/lua-ts-mode.el (lua-ts-mode): * lisp/progmodes/python.el (python-ts-mode): * lisp/progmodes/rust-ts-mode.el (rust-ts-mode): * lisp/progmodes/sh-script.el (bash-ts-mode): * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode): (tsx-ts-mode): * lisp/textmodes/css-mode.el (css-ts-mode): * lisp/textmodes/mhtml-ts-mode.el (mhtml-ts-mode): * lisp/textmodes/toml-ts-mode.el (toml-ts-mode): * lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode): * lisp/treesit-x.el (treesit-generic-mode-setup): Add the check.
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/css-mode.el4
-rw-r--r--lisp/textmodes/mhtml-ts-mode.el4
-rw-r--r--lisp/textmodes/toml-ts-mode.el4
-rw-r--r--lisp/textmodes/yaml-ts-mode.el4
4 files changed, 12 insertions, 4 deletions
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 355555df090..12632e24e0e 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -1888,7 +1888,9 @@ can also be used to fill comments.
\\{css-mode-map}"
:syntax-table css-mode-syntax-table
- (when (treesit-ensure-installed 'css)
+ ;; `treesit-ready-p' also checks for buffer size.
+ (when (and (treesit-ensure-installed 'css)
+ (treesit-ready-p 'css))
;; Borrowed from `css-mode'.
(setq-local syntax-propertize-function
css-syntax-propertize-function)
diff --git a/lisp/textmodes/mhtml-ts-mode.el b/lisp/textmodes/mhtml-ts-mode.el
index 2a1c62b87e4..d53d74e220a 100644
--- a/lisp/textmodes/mhtml-ts-mode.el
+++ b/lisp/textmodes/mhtml-ts-mode.el
@@ -511,7 +511,9 @@ Powered by tree-sitter."
;; jsdoc is not mandatory for js-ts-mode, so we respect this by
;; adding jsdoc range rules only when jsdoc is available.
- (when (treesit-ensure-installed 'jsdoc)
+ ;; `treesit-ready-p' also checks for buffer size.
+ (when (and (treesit-ensure-installed 'jsdoc)
+ (treesit-ready-p 'jsdoc))
(setq-local c-ts-common--comment-regexp
js--treesit-jsdoc-comment-regexp))
diff --git a/lisp/textmodes/toml-ts-mode.el b/lisp/textmodes/toml-ts-mode.el
index d3f09526b90..63e3f60edd9 100644
--- a/lisp/textmodes/toml-ts-mode.el
+++ b/lisp/textmodes/toml-ts-mode.el
@@ -138,7 +138,9 @@ Return nil if there is no name or if NODE is not a defun node."
:group 'toml-mode
:syntax-table toml-ts-mode--syntax-table
- (when (treesit-ensure-installed 'toml)
+ ;; `treesit-ready-p' also checks for buffer size.
+ (when (and (treesit-ensure-installed 'toml)
+ (treesit-ready-p 'toml))
(setq treesit-primary-parser (treesit-parser-create 'toml))
;; Comments
diff --git a/lisp/textmodes/yaml-ts-mode.el b/lisp/textmodes/yaml-ts-mode.el
index c1521c82c22..5afd4d2d111 100644
--- a/lisp/textmodes/yaml-ts-mode.el
+++ b/lisp/textmodes/yaml-ts-mode.el
@@ -262,7 +262,9 @@ Calls REPORT-FN directly."
:group 'yaml
:syntax-table yaml-ts-mode--syntax-table
- (when (treesit-ensure-installed 'yaml)
+ ;; `treesit-ready-p' also checks for buffer size.
+ (when (and (treesit-ensure-installed 'yaml)
+ (treesit-ready-p 'yaml))
(setq treesit-primary-parser (treesit-parser-create 'yaml))
;; Comments.