diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 20694c4abcf..e17f388216e 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -1674,8 +1674,7 @@ the code is C or C++, and based on that chooses whether to enable (funcall (major-mode-remap mode)))) ;;;###autoload -(when (treesit-available-p) - (defvar treesit-major-mode-remap-alist) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(c-mode . c-ts-mode)) (add-to-list 'treesit-major-mode-remap-alist diff --git a/lisp/progmodes/cmake-ts-mode.el b/lisp/progmodes/cmake-ts-mode.el index 9625b0f0330..60d03f50a12 100644 --- a/lisp/progmodes/cmake-ts-mode.el +++ b/lisp/progmodes/cmake-ts-mode.el @@ -284,11 +284,10 @@ is t or contains the mode name." (fundamental-mode))) ;;;###autoload -(when (treesit-available-p) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'auto-mode-alist '("\\(?:CMakeLists\\.txt\\|\\.cmake\\)\\'" . cmake-ts-mode-maybe)) ;; To be able to toggle between an external package and core ts-mode: - (defvar treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(cmake-mode . cmake-ts-mode))) diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index 236354ece27..86b925afa7d 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -1287,8 +1287,7 @@ Key bindings: (derived-mode-add-parents 'csharp-ts-mode '(csharp-mode)) ;;;###autoload -(when (treesit-available-p) - (defvar treesit-major-mode-remap-alist) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(csharp-mode . csharp-ts-mode))) diff --git a/lisp/progmodes/dockerfile-ts-mode.el b/lisp/progmodes/dockerfile-ts-mode.el index f02f97b6eb1..c2e8b1f3264 100644 --- a/lisp/progmodes/dockerfile-ts-mode.el +++ b/lisp/progmodes/dockerfile-ts-mode.el @@ -215,7 +215,7 @@ is t or contains the mode name." (fundamental-mode))) ;;;###autoload -(when (treesit-available-p) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'auto-mode-alist ;; NOTE: We can't use `rx' here, as it breaks bootstrap. ;; (rx (or (and (or "Dockerfile" "Containerfile") @@ -225,7 +225,6 @@ is t or contains the mode name." '("\\(?:\\(?:\\(?:Contain\\|Dock\\)erfile\\)\\(?:\\..*\\)?\\|\\.[Dd]ockerfile\\)\\'" . dockerfile-ts-mode-maybe)) ;; To be able to toggle between an external package and core ts-mode: - (defvar treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(dockerfile-mode . dockerfile-ts-mode))) diff --git a/lisp/progmodes/elixir-ts-mode.el b/lisp/progmodes/elixir-ts-mode.el index b6828a3d09c..1b57f4bb34d 100644 --- a/lisp/progmodes/elixir-ts-mode.el +++ b/lisp/progmodes/elixir-ts-mode.el @@ -815,13 +815,12 @@ is t or contains the mode name." (fundamental-mode))) ;;;###autoload -(when (treesit-available-p) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'auto-mode-alist '("\\.elixir\\'" . elixir-ts-mode-maybe)) (add-to-list 'auto-mode-alist '("\\.ex\\'" . elixir-ts-mode-maybe)) (add-to-list 'auto-mode-alist '("\\.exs\\'" . elixir-ts-mode-maybe)) (add-to-list 'auto-mode-alist '("mix\\.lock" . elixir-ts-mode-maybe)) ;; To be able to toggle between an external package and core ts-mode: - (defvar treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(elixir-mode . elixir-ts-mode))) diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el index 91664a4de48..484c87fed9f 100644 --- a/lisp/progmodes/go-ts-mode.el +++ b/lisp/progmodes/go-ts-mode.el @@ -380,10 +380,9 @@ is t or contains the mode name." (fundamental-mode))) ;;;###autoload -(when (treesit-available-p) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'auto-mode-alist '("\\.go\\'" . go-ts-mode-maybe)) ;; To be able to toggle between an external package and core ts-mode: - (defvar treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(go-mode . go-ts-mode))) @@ -658,10 +657,9 @@ is t or contains the mode name." (fundamental-mode))) ;;;###autoload -(when (treesit-available-p) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'auto-mode-alist '("/go\\.mod\\'" . go-mod-ts-mode-maybe)) ;; To be able to toggle between an external package and core ts-mode: - (defvar treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(go-mod-mode . go-mod-ts-mode))) @@ -763,10 +761,9 @@ is t or contains the mode name." (fundamental-mode))) ;;;###autoload -(when (treesit-available-p) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'auto-mode-alist '("/go\\.work\\'" . go-work-ts-mode-maybe)) ;; To be able to toggle between an external package and core ts-mode: - (defvar treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(go-work-mode . go-work-ts-mode))) diff --git a/lisp/progmodes/heex-ts-mode.el b/lisp/progmodes/heex-ts-mode.el index e9626e32f33..2cdec337821 100644 --- a/lisp/progmodes/heex-ts-mode.el +++ b/lisp/progmodes/heex-ts-mode.el @@ -278,12 +278,11 @@ is t or contains the mode name." (fundamental-mode))) ;;;###autoload -(when (treesit-available-p) +(when (boundp 'treesit-major-mode-remap-alist) ;; Both .heex and the deprecated .leex files should work ;; with the tree-sitter-heex grammar. (add-to-list 'auto-mode-alist '("\\.[hl]?eex\\'" . heex-ts-mode-maybe)) ;; To be able to toggle between an external package and core ts-mode: - (defvar treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(heex-mode . heex-ts-mode))) diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el index f8c486e1bea..5e45c55f42d 100644 --- a/lisp/progmodes/java-ts-mode.el +++ b/lisp/progmodes/java-ts-mode.el @@ -533,8 +533,7 @@ Return nil if there is no name or if NODE is not a defun node." (derived-mode-add-parents 'java-ts-mode '(java-mode)) ;;;###autoload -(when (treesit-available-p) - (defvar treesit-major-mode-remap-alist) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(java-mode . java-ts-mode))) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 5e54383cd9f..1a81fa6c7fa 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -4106,8 +4106,7 @@ See `treesit-thing-settings' for more information.") (derived-mode-add-parents 'js-ts-mode '(js-mode)) ;;;###autoload -(when (treesit-available-p) - (defvar treesit-major-mode-remap-alist) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(javascript-mode . js-ts-mode))) diff --git a/lisp/progmodes/json-ts-mode.el b/lisp/progmodes/json-ts-mode.el index a08e9a29fe8..2e823c11cee 100644 --- a/lisp/progmodes/json-ts-mode.el +++ b/lisp/progmodes/json-ts-mode.el @@ -182,8 +182,7 @@ Return nil if there is no name or if NODE is not a defun node." (derived-mode-add-parents 'json-ts-mode '(json-mode)) ;;;###autoload -(when (treesit-available-p) - (defvar treesit-major-mode-remap-alist) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(js-json-mode . json-ts-mode))) diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index 35700255ba4..8cbd2efda70 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el @@ -773,8 +773,7 @@ Calls REPORT-FN directly." (derived-mode-add-parents 'lua-ts-mode '(lua-mode)) ;;;###autoload -(when (treesit-available-p) - (defvar treesit-major-mode-remap-alist) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(lua-mode . lua-ts-mode))) diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el index fd5727b0f00..2c04c8cdeea 100644 --- a/lisp/progmodes/php-ts-mode.el +++ b/lisp/progmodes/php-ts-mode.el @@ -1994,7 +1994,7 @@ is t or contains the mode name." (fundamental-mode))) ;;;###autoload -(when (treesit-available-p) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'auto-mode-alist '("\\.\\(?:php[s345]?\\|phtml\\)\\'" . php-ts-mode-maybe)) (add-to-list @@ -2005,7 +2005,6 @@ is t or contains the mode name." 'interpreter-mode-alist (cons "php\\(?:-?[34578]\\(?:\\.[0-9]+\\)*\\)?" 'php-ts-mode-maybe)) ;; To be able to toggle between an external package and core ts-mode: - (defvar treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(php-mode . php-ts-mode))) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index f06d58a6c20..5a96972caa7 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -7442,8 +7442,7 @@ implementations: `python-mode' and `python-ts-mode'." (derived-mode-add-parents 'python-ts-mode '(python-mode))) ;;;###autoload -(when (and (fboundp 'treesit-available-p) (treesit-available-p) - (boundp 'treesit-major-mode-remap-alist)) ; Emacs 31.1 +(when (boundp 'treesit-major-mode-remap-alist) ; Emacs 31.1 (add-to-list 'treesit-major-mode-remap-alist '(python-mode . python-ts-mode))) diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index 742331ccddb..03ea6616ae1 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -1278,8 +1278,7 @@ leading double colon is not added." (derived-mode-add-parents 'ruby-ts-mode '(ruby-mode)) ;;;###autoload -(when (treesit-available-p) - (defvar treesit-major-mode-remap-alist) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(ruby-mode . ruby-ts-mode))) diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el index a98d621af65..cbd489c5e2c 100644 --- a/lisp/progmodes/rust-ts-mode.el +++ b/lisp/progmodes/rust-ts-mode.el @@ -668,10 +668,9 @@ is t or contains the mode name." (fundamental-mode))) ;;;###autoload -(when (treesit-available-p) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-ts-mode-maybe)) ;; To be able to toggle between an external package and core ts-mode: - (defvar treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(rust-mode . rust-ts-mode))) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 3b2601d251d..097cbaa0d6e 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1649,8 +1649,7 @@ not written in Bash or sh." (derived-mode-add-parents 'bash-ts-mode '(sh-mode)) ;;;###autoload -(when (treesit-available-p) - (defvar treesit-major-mode-remap-alist) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(sh-mode . bash-ts-mode))) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index e83ee70d7e9..848093e7d60 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -735,10 +735,9 @@ is t or contains the mode name." (fundamental-mode))) ;;;###autoload -(when (treesit-available-p) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode-maybe)) ;; To be able to toggle between an external package and core ts-mode: - (defvar treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(typescript-mode . typescript-ts-mode))) @@ -872,10 +871,9 @@ is t or contains the mode name." (fundamental-mode))) ;;;###autoload -(when (treesit-available-p) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode-maybe)) ;; To be able to toggle between an external package and core ts-mode: - (defvar treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(tsx-mode . tsx-ts-mode))) diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index ffecc86cbe0..a83dc28dc15 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1916,8 +1916,7 @@ can also be used to fill comments. (derived-mode-add-parents 'css-ts-mode '(css-mode)) ;;;###autoload -(when (treesit-available-p) - (defvar treesit-major-mode-remap-alist) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(css-mode . css-ts-mode))) diff --git a/lisp/textmodes/markdown-ts-mode.el b/lisp/textmodes/markdown-ts-mode.el index 4929f2d91ee..7e579f41628 100644 --- a/lisp/textmodes/markdown-ts-mode.el +++ b/lisp/textmodes/markdown-ts-mode.el @@ -422,10 +422,9 @@ is t or contains the mode name." (fundamental-mode))) ;;;###autoload -(when (treesit-available-p) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-ts-mode-maybe)) ;; To be able to toggle between an external package and core ts-mode: - (defvar treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(markdown-mode . markdown-ts-mode))) diff --git a/lisp/textmodes/mhtml-ts-mode.el b/lisp/textmodes/mhtml-ts-mode.el index 355c3201946..b97555de2fc 100644 --- a/lisp/textmodes/mhtml-ts-mode.el +++ b/lisp/textmodes/mhtml-ts-mode.el @@ -599,8 +599,7 @@ Powered by tree-sitter." (derived-mode-add-parents 'mhtml-ts-mode '(css-mode js-mode)) ;;;###autoload -(when (treesit-available-p) - (defvar treesit-major-mode-remap-alist) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(mhtml-mode . mhtml-ts-mode))) diff --git a/lisp/textmodes/toml-ts-mode.el b/lisp/textmodes/toml-ts-mode.el index f85ded35968..f52f7de7b42 100644 --- a/lisp/textmodes/toml-ts-mode.el +++ b/lisp/textmodes/toml-ts-mode.el @@ -173,8 +173,7 @@ Return nil if there is no name or if NODE is not a defun node." (derived-mode-add-parents 'toml-ts-mode '(toml-mode)) ;;;###autoload -(when (treesit-available-p) - (defvar treesit-major-mode-remap-alist) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(conf-toml-mode . toml-ts-mode))) diff --git a/lisp/textmodes/yaml-ts-mode.el b/lisp/textmodes/yaml-ts-mode.el index 61c70340f8e..c50daf8cead 100644 --- a/lisp/textmodes/yaml-ts-mode.el +++ b/lisp/textmodes/yaml-ts-mode.el @@ -240,10 +240,9 @@ is t or contains the mode name." (fundamental-mode))) ;;;###autoload -(when (treesit-available-p) +(when (boundp 'treesit-major-mode-remap-alist) (add-to-list 'auto-mode-alist '("\\.ya?ml\\'" . yaml-ts-mode-maybe)) ;; To be able to toggle between an external package and core ts-mode: - (defvar treesit-major-mode-remap-alist) (add-to-list 'treesit-major-mode-remap-alist '(yaml-mode . yaml-ts-mode)))