From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: emacs-29 56cd810b9d1: =?utf-8?Q?Don=E2=80=99t?= signal warning when loading go-ts-mode.el without grammar Date: Thu, 02 Mar 2023 09:41:12 +0200 Message-ID: <83r0u7eh2f.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39816"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 02 08:42:12 2023 Return-path: Envelope-to: ged-emacs-devel@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 1pXdZs-000A7V-9E for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Mar 2023 08:42:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXdZA-0006hH-7L; Thu, 02 Mar 2023 02:41:28 -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 1pXdYy-0006ey-HC for emacs-devel@gnu.org; Thu, 02 Mar 2023 02:41:17 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXdYu-0005Pa-5x; Thu, 02 Mar 2023 02:41:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:Subject:To:From:Date:in-reply-to: references; bh=607WOjVeBeqq4MJxRkINXp+SpsPVgknyBMd3+g+SWeI=; b=d5Muq0eQWsIzaw k+5d3lM5RObVGhTjlUHSksnA3l89LVBNXKbVER3vCtKakCcInP+5Sqxjlpow2JFhRfo/RTWV1LqjQ mok9TuDdJiKV3ri5xaXyCZmLa2YmNlKp2YtlG9oBkg5xHKZbb/Blsvv88NKA95JEaoKYgvRhpysH/ i7qq9HX6chJnLuiXFsykYIhrRVZH7R1YQSew8QgJ4nl0mEwJmUtcO834ZPQbtwMudCuqqOJyfXG0A 80JnOEJvZEQh5RuHcUyHs3eMg6dW8lr7wS6ZcHQWCzGN2a1y8+uUJzfnyeqhs5X+UWObLROJttumD RrXNDsMXnltQ+Xd6UKJw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXdYf-0003Y8-LJ; Thu, 02 Mar 2023 02:41:09 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:303889 Archived-At: > branch: emacs-29 > commit 56cd810b9d1a4d537bee5a2fd954d6e0d346631a > Author: Yuan Fu > Commit: Yuan Fu > > Don’t signal warning when loading go-ts-mode.el without grammar > > * lisp/progmodes/go-ts-mode.el: Add a QUIET flag to the call of > treesit-ready-p, so that it doesn't signal a warning if > go-mod (tree-sitter grammar) is not available. > --- > lisp/progmodes/go-ts-mode.el | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el > index e8f93d14744..6043c86ac93 100644 > --- a/lisp/progmodes/go-ts-mode.el > +++ b/lisp/progmodes/go-ts-mode.el > @@ -393,7 +393,7 @@ what the parent of the node would be if it were a node." > > (treesit-major-mode-setup))) > > -(if (treesit-ready-p 'gomod) > +(if (treesit-ready-p 'gomod t) > (add-to-list 'auto-mode-alist '("/go\\.mod\\'" . go-mod-ts-mode))) > > (provide 'go-ts-mode) Yuan, why was this change made? The fact that loading go-ts-mode.el without a grammar library causes a warning is the intended behavior: users who don't have tree-sitter setup for Go shouldn't load this mode, and if they do, they should know it failed, and why. The above change makes it fail silently, which is not a Good Thing. What was the problem you were trying to solve? The subsequent change, viz.: > branch: emacs-29 > commit 59365f928565f1be551b1697b9246b00cb87a9b7 > Author: Yuan Fu > Commit: Yuan Fu > > * lisp/progmodes/go-ts-mode.el: Use treesit-language-available-p. > > treesit-ready-p does more checks than language grammar availability. > --- > lisp/progmodes/go-ts-mode.el | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el > index 6043c86ac93..fbe085a2c6c 100644 > --- a/lisp/progmodes/go-ts-mode.el > +++ b/lisp/progmodes/go-ts-mode.el > @@ -393,7 +393,7 @@ what the parent of the node would be if it were a node." > > (treesit-major-mode-setup))) > > -(if (treesit-ready-p 'gomod t) > +(if (treesit-language-available-p 'gomod) > (add-to-list 'auto-mode-alist '("/go\\.mod\\'" . go-mod-ts-mode))) > > (provide 'go-ts-mode) made this even worse: now we have a byte-compilation warning in a build without tree-sitter, and this code will signal a generic error (whose text is not very helpful to users) if the file is loaded in a build without tree-sitter. This is all against the intended behavior of these modes. Again, what problem were you trying to fix with that change?