1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 18:41:25 -08:00

Check if treesit-major-mode-remap-alist is bound in ts-modes autoload forms

* lisp/progmodes/c-ts-mode.el:
* lisp/progmodes/cmake-ts-mode.el:
* lisp/progmodes/csharp-mode.el:
* lisp/progmodes/dockerfile-ts-mode.el:
* lisp/progmodes/elixir-ts-mode.el:
* lisp/progmodes/go-ts-mode.el:
* lisp/progmodes/heex-ts-mode.el:
* lisp/progmodes/java-ts-mode.el:
* lisp/progmodes/js.el:
* lisp/progmodes/json-ts-mode.el:
* lisp/progmodes/lua-ts-mode.el:
* lisp/progmodes/php-ts-mode.el:
* lisp/progmodes/python.el:
* lisp/progmodes/ruby-ts-mode.el:
* lisp/progmodes/rust-ts-mode.el:
* lisp/progmodes/sh-script.el:
* lisp/progmodes/typescript-ts-mode.el:
* lisp/textmodes/css-mode.el:
* lisp/textmodes/markdown-ts-mode.el:
* lisp/textmodes/mhtml-ts-mode.el:
* lisp/textmodes/toml-ts-mode.el:
* lisp/textmodes/yaml-ts-mode.el: In autoload forms replace
'(treesit-available-p)' with (boundp 'treesit-major-mode-remap-alist).
Calling 'treesit-available-p' in loaddefs.el is too early
since the tree-sitter library might not be loaded yet.
Checking if 'treesit-major-mode-remap-alist' is bound is
equivalent to checking if Emacs is compiled with tree-sitter support.
(bug#79622)
This commit is contained in:
Juri Linkov 2025-10-16 09:43:30 +03:00
parent 88c18efb3a
commit 0a4503de3a
22 changed files with 25 additions and 50 deletions

View file

@ -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)))