From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Brian Leung Newsgroups: gmane.emacs.bugs Subject: bug#59471: [PATCH] sh-mode: Run treesit-ready-p only when sh-shell is 'bash Date: Tue, 22 Nov 2022 02:54:55 +0000 Message-ID: <87bkozpukg.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38425"; mail-complaints-to="usenet@ciao.gmane.io" To: 59471@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 22 03:56:11 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oxJSF-0009li-1s for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 22 Nov 2022 03:56:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oxJS9-0003oX-2t; Mon, 21 Nov 2022 21:56:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oxJS7-0003o9-3s for bug-gnu-emacs@gnu.org; Mon, 21 Nov 2022 21:56:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oxJS6-0002AQ-RP for bug-gnu-emacs@gnu.org; Mon, 21 Nov 2022 21:56:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oxJS6-0000le-II for bug-gnu-emacs@gnu.org; Mon, 21 Nov 2022 21:56:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Brian Leung Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Nov 2022 02:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59471 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16690857062872 (code B ref -1); Tue, 22 Nov 2022 02:56:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Nov 2022 02:55:06 +0000 Original-Received: from localhost ([127.0.0.1]:49292 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxJRB-0000kG-LU for submit@debbugs.gnu.org; Mon, 21 Nov 2022 21:55:06 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:36472) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxJR8-0000k3-Fq for submit@debbugs.gnu.org; Mon, 21 Nov 2022 21:55:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oxJR8-0003k3-8k for bug-gnu-emacs@gnu.org; Mon, 21 Nov 2022 21:55:02 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oxJR6-0001p4-5U for bug-gnu-emacs@gnu.org; Mon, 21 Nov 2022 21:55:02 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 230FC240101 for ; Tue, 22 Nov 2022 03:54:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1669085698; bh=KEYL9HiVI2Ly9acXDkfpPAYCufES9LpLWg8XhgKV8+I=; h=From:To:Subject:Date:From; b=rr8D1b+ti6vXzgHEC81GPDyXiekdBK3lFip9CjHMMNjN0whQr9yJi6XyjE2xgKtys dmZVfgblvkB1xQkSLGNdwnd0F9qvRucafunVpZiveNsWhBvM6TjUFk/9PO5E+bxd0x Y/YaviTXSbI4BNH3xDGAM1sqal4C1d5ovo8TcN2UxDcpyzh64hFMpiOGyWVH43mTcu WYEkaKYkNn1JJQsfW27CEn41Jnj5lWSfeXigf53sQH0Zz21Ne9LgJzRhcT4VKzkn5z 0mMgfhtGA+VpoImXzd3B5wMWuE8j6lai1pJvntyfpom5AKbNM2lyItwpT729aBxSZN AYVlWZ/9K12RA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4NGTPs0FJ9z6tqs for ; Tue, 22 Nov 2022 03:54:56 +0100 (CET) Received-SPF: pass client-ip=185.67.36.66; envelope-from=leungbk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:248599 Archived-At: --=-=-= Content-Type: text/plain Tags: patch This patch guards the treesit-ready-p check to run only when sh-shell is 'bash, in order to prevent an annoying warning when viewing (say) sh or zsh files. But maybe we also want to allow treesitter when sh-shell is 'sh? In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars) Repository revision: aeadba1418d8fc18f17b4ae415cde35e9e272e7a Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12014000 System Description: NixOS 22.11 (Raccoon) Configured using: 'configure --prefix=/nix/store/yf7bpm9w6nqwil5xfxa9iz22m57wz4l1-emacs-git-20221121.0 --disable-build-details --with-modules --with-x-toolkit=lucid --with-xft --with-cairo --with-native-compilation' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-sh-mode-Run-treesit-ready-p-only-when-sh-shell-is-ba.patch >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 --=-=-=--