diff --git a/lisp/progmodes/cmake-ts-mode.el b/lisp/progmodes/cmake-ts-mode.el index 854adf4ade7..597ef69d9b8 100644 --- a/lisp/progmodes/cmake-ts-mode.el +++ b/lisp/progmodes/cmake-ts-mode.el @@ -208,7 +208,7 @@ Return nil if there is no name or if NODE is not a defun node." :syntax-table cmake-ts-mode--syntax-table (when (treesit-ready-p 'cmake) - (treesit-parser-create 'cmake) + (setq treesit-primary-parser (treesit-parser-create 'cmake)) ;; Comments. (setq-local comment-start "# ") diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index 1f86527191a..b86555b1d87 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -1049,7 +1049,7 @@ Key bindings: (error "Tree-sitter for C# isn't available")) ;; Tree-sitter. - (treesit-parser-create 'c-sharp) + (setq treesit-primary-parser (treesit-parser-create 'c-sharp)) ;; Comments. (c-ts-common-comment-setup) diff --git a/lisp/progmodes/dockerfile-ts-mode.el b/lisp/progmodes/dockerfile-ts-mode.el index e31fd86bbdf..42fa7482a87 100644 --- a/lisp/progmodes/dockerfile-ts-mode.el +++ b/lisp/progmodes/dockerfile-ts-mode.el @@ -133,7 +133,7 @@ Return nil if there is no name or if NODE is not a stage node." :syntax-table dockerfile-ts-mode--syntax-table (when (treesit-ready-p 'dockerfile) - (treesit-parser-create 'dockerfile) + (setq treesit-primary-parser (treesit-parser-create 'dockerfile)) ;; Comments. (setq-local comment-start "# ") diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el index cb9a58e33b5..6fa8049e5e7 100644 --- a/lisp/progmodes/go-ts-mode.el +++ b/lisp/progmodes/go-ts-mode.el @@ -262,7 +262,7 @@ :syntax-table go-ts-mode--syntax-table (when (treesit-ready-p 'go) - (treesit-parser-create 'go) + (setq treesit-primary-parser (treesit-parser-create 'go)) ;; Comments. (setq-local comment-start "// ") @@ -539,7 +539,7 @@ what the parent of the node would be if it were a node." :syntax-table go-mod-ts-mode--syntax-table (when (treesit-ready-p 'gomod) - (treesit-parser-create 'gomod) + (setq treesit-primary-parser (treesit-parser-create 'gomod)) ;; Comments. (setq-local comment-start "// ") diff --git a/lisp/progmodes/heex-ts-mode.el b/lisp/progmodes/heex-ts-mode.el index b527d96b579..84fd513525c 100644 --- a/lisp/progmodes/heex-ts-mode.el +++ b/lisp/progmodes/heex-ts-mode.el @@ -148,7 +148,7 @@ With ARG, do it many times. Negative ARG means move backward." :group 'heex-ts (when (treesit-ready-p 'heex) - (treesit-parser-create 'heex) + (setq treesit-primary-parser (treesit-parser-create 'heex)) ;; Comments (setq-local treesit-thing-settings diff --git a/lisp/progmodes/json-ts-mode.el b/lisp/progmodes/json-ts-mode.el index 1fb96555010..7409c6be833 100644 --- a/lisp/progmodes/json-ts-mode.el +++ b/lisp/progmodes/json-ts-mode.el @@ -128,7 +128,7 @@ Return nil if there is no name or if NODE is not a defun node." (unless (treesit-ready-p 'json) (error "Tree-sitter for JSON isn't available")) - (treesit-parser-create 'json) + (setq treesit-primary-parser (treesit-parser-create 'json)) ;; Comments. (setq-local comment-start "// ") diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index a1dae0628d4..20bc1f3e158 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el @@ -750,7 +750,7 @@ Calls REPORT-FN directly." (use-local-map lua-ts-mode-map) (when (treesit-ready-p 'lua) - (treesit-parser-create 'lua) + (setq treesit-primary-parser (treesit-parser-create 'lua)) ;; Comments. (setq-local comment-start "--") diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index a75317b3b0e..6d57517cd25 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -7182,7 +7182,7 @@ implementations: `python-mode' and `python-ts-mode'." \\{python-ts-mode-map}" :syntax-table python-mode-syntax-table (when (treesit-ready-p 'python) - (treesit-parser-create 'python) + (setq treesit-primary-parser (treesit-parser-create 'python)) (setq-local treesit-font-lock-feature-list '(( comment definition) ( keyword string type) diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index adcdf15c7ad..aff0b8911b9 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -1127,7 +1127,7 @@ leading double colon is not added." (unless (treesit-ready-p 'ruby) (error "Tree-sitter for Ruby isn't available")) - (treesit-parser-create 'ruby) + (setq treesit-primary-parser (treesit-parser-create 'ruby)) (setq-local add-log-current-defun-function #'ruby-ts-add-log-current-function) diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el index b7a52b06b24..e52ea3b125a 100644 --- a/lisp/progmodes/rust-ts-mode.el +++ b/lisp/progmodes/rust-ts-mode.el @@ -511,7 +511,7 @@ See `prettify-symbols-compose-predicate'." :syntax-table rust-ts-mode--syntax-table (when (treesit-ready-p 'rust) - (treesit-parser-create 'rust) + (setq treesit-primary-parser (treesit-parser-create 'rust)) ;; Syntax. (setq-local syntax-propertize-function diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index a348e9ba6fd..8ba64100203 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1623,7 +1623,7 @@ not written in Bash or sh." (add-hook 'flymake-diagnostic-functions #'sh-shellcheck-flymake nil t) (add-hook 'hack-local-variables-hook #'sh-after-hack-local-variables nil t) - (treesit-parser-create 'bash) + (setq treesit-primary-parser (treesit-parser-create 'bash)) (setq-local treesit-font-lock-feature-list '(( comment function) ( command declaration-command keyword string) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index b1288f17d86..ef5dbe51ada 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -515,7 +515,7 @@ This mode is intended to be inherited by concrete major modes." :syntax-table typescript-ts-mode--syntax-table (when (treesit-ready-p 'typescript) - (treesit-parser-create 'typescript) + (setq treesit-primary-parser (treesit-parser-create 'typescript)) ;; Indent. (setq-local treesit-simple-indent-rules @@ -553,7 +553,7 @@ at least 3 (which is the default value)." :syntax-table typescript-ts-mode--syntax-table (when (treesit-ready-p 'tsx) - (treesit-parser-create 'tsx) + (setq treesit-primary-parser (treesit-parser-create 'tsx)) ;; Comments. (setq-local comment-start "// ") diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index f5a20e0ca0e..c8da28187ee 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1814,7 +1814,7 @@ can also be used to fill comments. (setq-local font-lock-fontify-region-function #'css--fontify-region) ;; Tree-sitter specific setup. - (treesit-parser-create 'css) + (setq treesit-primary-parser (treesit-parser-create 'css)) (setq-local treesit-simple-indent-rules css--treesit-indent-rules) (setq-local treesit-defun-type-regexp "rule_set") (setq-local treesit-defun-name-function #'css--treesit-defun-name) diff --git a/lisp/textmodes/html-ts-mode.el b/lisp/textmodes/html-ts-mode.el index 235e1055fa9..f78fbdde1da 100644 --- a/lisp/textmodes/html-ts-mode.el +++ b/lisp/textmodes/html-ts-mode.el @@ -92,7 +92,7 @@ Return nil if there is no name or if NODE is not a defun node." (unless (treesit-ready-p 'html) (error "Tree-sitter for HTML isn't available")) - (treesit-parser-create 'html) + (setq treesit-primary-parser (treesit-parser-create 'html)) ;; Indent. (setq-local treesit-simple-indent-rules html-ts-mode--indent-rules) diff --git a/lisp/textmodes/toml-ts-mode.el b/lisp/textmodes/toml-ts-mode.el index 3c4533a7fea..806f045c23b 100644 --- a/lisp/textmodes/toml-ts-mode.el +++ b/lisp/textmodes/toml-ts-mode.el @@ -124,7 +124,7 @@ Return nil if there is no name or if NODE is not a defun node." :syntax-table toml-ts-mode--syntax-table (when (treesit-ready-p 'toml) - (treesit-parser-create 'toml) + (setq treesit-primary-parser (treesit-parser-create 'toml)) ;; Comments (setq-local comment-start "# ") diff --git a/lisp/textmodes/yaml-ts-mode.el b/lisp/textmodes/yaml-ts-mode.el index 210835585fe..42d7c2e1798 100644 --- a/lisp/textmodes/yaml-ts-mode.el +++ b/lisp/textmodes/yaml-ts-mode.el @@ -148,7 +148,7 @@ boundaries. JUSTIFY is passed to `fill-paragraph'." :syntax-table yaml-ts-mode--syntax-table (when (treesit-ready-p 'yaml) - (treesit-parser-create 'yaml) + (setq treesit-primary-parser (treesit-parser-create 'yaml)) ;; Comments. (setq-local comment-start "# ")