From unknown Sat Aug 16 11:42:07 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#59471 <59471@debbugs.gnu.org> To: bug#59471 <59471@debbugs.gnu.org> Subject: Status: [PATCH] sh-mode: Run treesit-ready-p only when sh-shell is 'bash Reply-To: bug#59471 <59471@debbugs.gnu.org> Date: Sat, 16 Aug 2025 18:42:07 +0000 retitle 59471 [PATCH] sh-mode: Run treesit-ready-p only when sh-shell is 'b= ash reassign 59471 emacs submitter 59471 Brian Leung severity 59471 normal tag 59471 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 21 21:55:06 2022 Received: (at submit) by debbugs.gnu.org; 22 Nov 2022 02:55:06 +0000 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 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 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 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 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== 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) From: Brian Leung To: bug-gnu-emacs@gnu.org Subject: [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="=-=-=" 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-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= 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 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 22 20:39:23 2022 Received: (at 59471-done) by debbugs.gnu.org; 23 Nov 2022 01:39:23 +0000 Received: from localhost ([127.0.0.1]:52965 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxejS-0005dn-MB for submit@debbugs.gnu.org; Tue, 22 Nov 2022 20:39:22 -0500 Received: from mail-pl1-f170.google.com ([209.85.214.170]:37777) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxejN-0005dW-E1 for 59471-done@debbugs.gnu.org; Tue, 22 Nov 2022 20:39:20 -0500 Received: by mail-pl1-f170.google.com with SMTP id p12so15335501plq.4 for <59471-done@debbugs.gnu.org>; Tue, 22 Nov 2022 17:39:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=c1emr8PoFW4rSKxw1h077mYF4q0mtM1M4AvTdFYRjto=; b=bthChdLW932HDdLaZyrOTLivBGS0QkU8/1dCGhfGJQvzdotaUIAs3EUouSEcTudv9A oyRew7QkZy+/nrqbamfMFGZun5rRfq5pl99KFREko/k5cGogv7M6Xmw31kr8WTvFLMkl VlNyByOqeU6VkBMaYaOZtIjOsE/jJcolmJtaG20om7wFgZM1vnXyFMZiP/Jg+IHNa7RM ugyWIPs/sydQ4zq8P2Q8H74EY9gc6uICjpQqeq7yVIVQ8b10RByf3llIeaNVeyrxI3Zs Od6Ub1JH9EbQESqblEREwHc9RMmsc/3rhbh+ecGwqthh8vE/EJKJDHhPun7bKOtz23Ri Cmcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c1emr8PoFW4rSKxw1h077mYF4q0mtM1M4AvTdFYRjto=; b=L7kWdZhtFaATvnQkcYg3cPhI8WPcQaSTxjHM9X6/v6vi23PS10gDv6q54Jgyfoe91G WlFRfK6JSLmfzo1v/vgVYfBuqAYh6jUih7n3jF0PQny4NbGqCoMPBwHONFxtDZWK05Vb GPG7ZmESs/05+9EpEmQ9MRB3CkJMalZDYuB5VcmzJI6ucKW2x3tGT0YMuWojSQmGkM3L 60chFUy0tlLAD9ntmF8G7bKZPPzKDPwunSnCClKpoEAx1ACzt1b2nTEyBngSUupjex6e kECtDY/rGCOYrG2UZpBIp3pzuWYcgHBHJ7pC1judKnvx6Riof4zgrJ9zDWpEIY/w2WnR duUQ== X-Gm-Message-State: ANoB5pmaOcrLoXAzH8QZ0RLUoL1faC0soR60U2s2z6yDmcxctaUSJHmV jsRTQ+A5VV8T3M4JBiM/06w= X-Google-Smtp-Source: AA0mqf4rDtsjrRKh1qT6khDIDaeuDVKJ73NwU59lNf7cyqk1kGhivKpEsbBUL5E+tlkRBXCKKvBRUg== X-Received: by 2002:a17:902:b908:b0:189:1ef4:237b with SMTP id bf8-20020a170902b90800b001891ef4237bmr7059266plb.20.1669167551311; Tue, 22 Nov 2022 17:39:11 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id x3-20020aa79403000000b0056d2317455bsm11324010pfo.7.2022.11.22.17.39.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Nov 2022 17:39:10 -0800 (PST) From: Yuan Fu Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: bug#59471: [PATCH] sh-mode: Run treesit-ready-p only when sh-shell is 'bash Message-Id: <16C1E196-AD5B-4358-BCFD-BF5995EC21D0@gmail.com> Date: Tue, 22 Nov 2022 17:39:08 -0800 To: leungbk@posteo.net X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 59471-done Cc: 59471-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Brian Leung writes: > 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? Oh, thanks! Though I did it a bit differently, by separating tree-sitter-based mode into a independent major mode (sh-ts-mode), which is in line with other tree-sitter-based modes (python-ts-mode, js-ts-mode, etc). How to make bash-ts-mode fallback to sh-mode when it encounters a shell script other than bash is still in discussion. Yuan From unknown Sat Aug 16 11:42:07 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 21 Dec 2022 12:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator