From aa8c60cff6f834e18db44587a6e623292b01978e Mon Sep 17 00:00:00 2001 From: Brian Leung Date: Mon, 21 Nov 2022 18:52:26 -0800 Subject: [PATCH] sh-mode: Run treesit-ready-p only when sh-shell is 'bash * lisp/progmodes/sh-script.el (sh-mode): Guard treesit-ready-p check. Without this patch, enabling sh-mode in any non-Bash file results in an annoying warning like: Warning (treesit): Cannot activate tree-sitter, because language definition for zsh is unavailable (not-found): (libtree-sitter-zsh libtree-sitter-zsh.so) No such file or directory --- lisp/progmodes/sh-script.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 54f005508c..0a0617bddd 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1587,7 +1587,8 @@ sh-mode (cond ;; Tree-sitter. If the shell is bash, we can enable tree-sitter. - ((treesit-ready-p sh-shell) + ((and (eq sh-shell 'bash) + (treesit-ready-p sh-shell)) (setq-local treesit-font-lock-feature-list '((comment function string heredoc) (variable keyword command declaration-command) -- 2.38.1