From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: =?utf-8?Q?Re=3A_emacs-29_56cd810b9d1=3A_Don=E2=80=99t_signal_warn?= =?utf-8?Q?ing_when_loading_go-ts-mode=2Eel_without_grammar?= Date: Fri, 3 Mar 2023 14:06:03 -0800 Message-ID: <5B384B39-F6DD-4E32-8506-A6D2BB940CAD@gmail.com> References: <83r0u7eh2f.fsf@gnu.org> <6B49E4E7-8FB6-47A6-A380-538BEE2DE1E1@gmail.com> <83edq6cmdr.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6246"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Mar 03 23:06:57 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 1pYDYH-0001QW-Mp for ged-emacs-devel@m.gmane-mx.org; Fri, 03 Mar 2023 23:06:57 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pYDXh-0001z6-CZ; Fri, 03 Mar 2023 17:06:21 -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 1pYDXf-0001yh-Q0 for emacs-devel@gnu.org; Fri, 03 Mar 2023 17:06:19 -0500 Original-Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pYDXe-00059M-04; Fri, 03 Mar 2023 17:06:19 -0500 Original-Received: by mail-pj1-x1035.google.com with SMTP id me6-20020a17090b17c600b0023816b0c7ceso7606169pjb.2; Fri, 03 Mar 2023 14:06:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677881175; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=hiH5iuGixp0ZZ558Ah2jcm9Z7wxYWa+YKNjBt5g6YYQ=; b=W8YmMbzOELZkQoESO3r8FWBRkWsWaO2L0aNgQG21M1yHh4AtbMvMDoNKM5loV2HegV O4X6f9wI5EBtLI24vG+JcTD8uokw/QJVxT8wv9xLhJ50CAtao5bSnD7U2+QeZ++8pCcF 7uljr+Hlo9KxZBZvnz0zgJu9SE3D7E6TBuuPjEpjnt516mPNURcTqvyGDWfaIMbPd+wC gRjOzUWSTxjClU+LOQrf3M2KT9yJxMflpqVEmb6he8yG3bOrdLNFnIbcPgzVbbZSguRs 9TElrGCrGgMy9vBF0ZZKxWmpCxizLGW6aH/Jbb07szUiZkcfaZQMVz2DFktVHsZU0UAj N0Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677881175; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hiH5iuGixp0ZZ558Ah2jcm9Z7wxYWa+YKNjBt5g6YYQ=; b=TVe/8M0vnxArONc9TpbcOLJn9OZv5csw2YCj0eWM78QQ0xePpggwMpQkWY2rEB0qzC vYbESOE2QrKZ7u58VWftCwesE4E+g6RfujwIXU/lOzdZewWhRGQNQlTo7ulU1wM1Qqx4 9EMxmlG9Y7gJeEkJKbV7nEhw+k4uvPt0SjOAUGYFwB4B+AkXnawKRqVeKC8GElAEEX9E y34i39h6HZYSOYHQKUgqXYdt0m+thnL7OdzM/etn7XCI2SIhjglQACeveWyTdi2Bt8E/ RtinVN+WUrslot+coA/o9wdDHj9AsuKANrFqjSDBhlOwXjUCZiW5g3o0t9nHru9DD7kI B08w== X-Gm-Message-State: AO0yUKXoNfGYCwGPJPORbOR9dYXLC/p8Nr4quZCC02LE8Obs8ovzaQiy KomfzZzbh2aSEzy/PLUivKdG1fGrbt14lw== X-Google-Smtp-Source: AK7set+sAiP4acm2L4EpaKl5TKjApsJeX9EdymMqQg+OtrynuQBUcA/jYpls3vLrvEoicIkaty4vFQ== X-Received: by 2002:a05:6a20:8f08:b0:c7:6a98:5bdc with SMTP id b8-20020a056a208f0800b000c76a985bdcmr4845470pzk.16.1677881175590; Fri, 03 Mar 2023 14:06:15 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id g5-20020aa78745000000b0058a3d8eab6asm2083824pfo.134.2023.03.03.14.06.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Mar 2023 14:06:15 -0800 (PST) In-Reply-To: <83edq6cmdr.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.400.51.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=casouri@gmail.com; helo=mail-pj1-x1035.google.com 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:303927 Archived-At: > On Mar 2, 2023, at 11:41 PM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Thu, 2 Mar 2023 19:05:27 -0800 >> Cc: Emacs developers >>=20 >>>=20 >>> 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. >>=20 >> I thought that we=E2=80=99d want the warning to appear when user = calls go-mod-ts-mode or open a file that uses that mode, rather than at = load time. What I had in mind is when someone only install = tree-sitter-go and want to edit some Go file, and they get this warning = of go-mod being not available. This is what I encountered which prompted = this change. I didn=E2=80=99t know that was intentional; since it=E2=80=99= s intentional, please revert it (maybe you already have), and sorry for = the hiccup :-) >=20 > This will happen with any *-ts-mode.el file that defines more than one > mode for more than one grammar. The only way of avoiding this is to > separate the modes, and we decided not to do that, presumably for good > reasons. So the result is that users who want to edit Go files must > also install the grammar for go.mod files (and similarly with C and > C++). The root cause is that when the file is loaded, we have no way > of knowing for which of the two modes it was loaded. This is a > disadvantage of this arrangement, but as long as we keep these modes > together on a single file, I don't see how we can avoid that. >=20 > So please revert those changes, as they go against what is planned for > Emacs 29. >=20 >>> 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. >>>=20 >>> Again, what problem were you trying to fix with that change? >>=20 >> Treesit-ready-p is intended to be used for major modes, so it = includes checks for current buffer=E2=80=99s size, which doesn=E2=80=99t = make much sense when called when loading the file. But if you = intentionally used that function for the warning, I guess there is no = harm using it this way, as the default size threshold is rather large. >=20 > If we want to avoid the buffer size text in some cases, we can add an > optional argument to treesit-ready-p, and use it in those places. > (And I agree that the test is probably harmless anyway.) I=E2=80=99ve reverted the change. Yuan=