From 0a4503de3a5a94fda8a81c8847a5cc4bf8bbe545 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 16 Oct 2025 09:43:30 +0300 Subject: 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) --- lisp/progmodes/python.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lisp/progmodes/python.el') 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))) -- cgit v1.2.1