From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: An anonymous IRC user's opinion Date: Mon, 4 Nov 2024 19:41:13 +0200 Message-ID: <61171da3-7428-4572-bc13-783766a123b5@gutov.dev> References: <87plodsjsd.fsf@web.de> <865xq14dwp.fsf@gnu.org> <343c4d04-af53-4da2-9d1c-c616c74821e1@gutov.dev> <86plo8369c.fsf@gnu.org> <63edeeea-1f24-4d3b-abc8-b96b164942e4@gutov.dev> <8634l1zsej.fsf@gnu.org> <9a8b97f8-def3-43ce-b71b-1f09bb05afd4@gutov.dev> <86cyk4vcld.fsf@gnu.org> <86ttdgthg2.fsf@gnu.org> <86ed4kt2ws.fsf@gnu.org> <8e30fb5c-8e1b-4f73-98eb-50c5c396efb0@gutov.dev> <86ldyqsrax.fsf@gnu.org> <10864c02-4bfd-41c3-bb45-6fe1155f9676@gutov.dev> <867ca9shcw.fsf@gnu.org> <7cb15f5c-efd0-4516-8190-a53c0d958eb6@gutov.dev> <86ses8x1po.fsf@gnu.org> <865xp3w64u.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5181"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: johan.myreen@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 04 18:42:01 2024 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 1t815U-00018B-7p for ged-emacs-devel@m.gmane-mx.org; Mon, 04 Nov 2024 18:42:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t814w-0000FG-Ey; Mon, 04 Nov 2024 12:41:26 -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 1t814t-0000F4-2v for emacs-devel@gnu.org; Mon, 04 Nov 2024 12:41:23 -0500 Original-Received: from fout-a5-smtp.messagingengine.com ([103.168.172.148]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t814p-0001qr-J5; Mon, 04 Nov 2024 12:41:22 -0500 Original-Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id 746061380434; Mon, 4 Nov 2024 12:41:16 -0500 (EST) Original-Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Mon, 04 Nov 2024 12:41:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1730742076; x=1730828476; bh=hKusy0EAs6w9uSXvRWBfFcKuXcUpvweBfEOTkipcjGc=; b= e1oyexQ1BeblwdRqiPaE98a4hkyRGz1bi1cVJWvhLSFTsMRMXchRF3Q1luMjZj9b XDIx4U/tmzTFwnkBJLfFMrMa4wdJrxEhit3ji4be2mdNYZ6euopubz/pnesGKWTv ezkyu5EsX5+n3zwN5B/UzqYwpUuJbpcuqWae1iZ5J3/bbvWceP8R9Q3RvGJTyAJo 4H8QlDB723YyAitMqDQu7Z9+fXRZoBn/BJNW5CLyQ37uBkwF+FbVKQFk6z6h4Dl7 FU+MTmIL1gEljUheRZBhRaUp99RoVAbKtok8UAhI/UROsGadiJH1VYxPEN9+fXbR r9fneKnbJCxKAV9h+dkdpw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1730742076; x= 1730828476; bh=hKusy0EAs6w9uSXvRWBfFcKuXcUpvweBfEOTkipcjGc=; b=d xHGqh5PLI7sQBPrF9k02VwTSWiTtDRuc0zTZ0MiprPxPQsJtYh3CdRW4MbkEsOKy SAPzdajZMaCxzfw8HPqQeTcL68UbzpLcs6zHf2RDKMvvbPHIVxm0SEviyl6qmfN+ 5cwFQBJKdD0QED6qGc0y4JozXgP6DqBxD1Qdv8bSl10mDoiA02kELzZeY+UKHvbG zx28YO4wUxa+g6OXYmRqSLY2V4RMxqSmzo4y0Ssqs66BTkcuV7amPlyCTPF0OYQI Y1GinQHE0JUM1o5q2uEHPTgRIwzBiMHcA4vTQb5wHqoZ9kYevW5OBOWJRfutmJKJ cin15vh68XK8v1PVnhf2w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeliedguddtvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddv jeenucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrd guvghvqeenucggtffrrghtthgvrhhnpeetudeljeegheetgfehgeejkeeuhedvveeikeeu fedtvddtveefhfdvveegudejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvhdpnhgspghrtghpthht ohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepvghlihiisehgnhhurdhorh hgpdhrtghpthhtohepjhhohhgrnhdrmhihrhgvvghnsehgmhgrihhlrdgtohhmpdhrtghp thhtohepvghmrggtshdquggvvhgvlhesghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 4 Nov 2024 12:41:15 -0500 (EST) Content-Language: en-US In-Reply-To: <865xp3w64u.fsf@gnu.org> Received-SPF: pass client-ip=103.168.172.148; envelope-from=dmitry@gutov.dev; helo=fout-a5-smtp.messagingengine.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 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_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_SBL_A=0.1 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:325115 Archived-At: On 04/11/2024 14:11, Eli Zaretskii wrote: > I'd prefer not to assume that the mere presence of libtree-sitter > means the user wants to use modes. If we don't override existing traditional modes, what's the harm? If we also exclude "small" modes like toml-ts-mode and dockerfile-ts-mode from being enabled by default, we can be reasonably sure that when the user visits a matching file, they will want to have the grammar installed. >>> Because your code seems to only test the latter, or so it seems. If >>> so, I don't think it's an idea to which I'd agree. E.g., imagine a >>> user who installed Emacs from some distro which decided to build with >>> Tree-Sitter, but doesn't provide all the grammar libraries we require, >>> for whatever reasons. >> >> Then, when visiting let's say a Go file (or Rust, or TypeScript) they >> will right away be greeted by a warning that the grammar is not >> available, search the docs how to deal with that, and hopefully install >> it somehow (maybe using M-x treesit-install-language-grammar). If they >> don't, perhaps they'll disable the file association manually - or live >> with the warning when visiting such files. > > Without the user's say-so, this could be considered a nuisance. Why > should Emacs annoy a user with some potential feature when the user > didn't say she wants to use it? Could be considered a nuisance, or a boon. Somebody tries to open a Go file, and sees *no* syntax highlighting, indentation support, etc. When the grammar is not installed, our options here are either: - Silently provide no features, nor explanations why they are not working. Whether the major mode is enabled or not, it offers no explanation on how to fix things. - Or issue a warning that the grammar is not installed. This would make it easier to find the next steps. > This is not a marketing stance, is > it? If making a feature easier to set up and use is a marketing stance, then okay, it is. Note that I don't have a goal of forcing tree-sitter on everybody: previously I suggested to have all ts mode off by default. But if we're going to set them up, the above seems to make the most sense. >>> A minor nit: I don't see how c-ts-mode will be invoked under your >>> proposal. What did I miss? >> >> You mean how it will be enabled globally, right? Not just invoked. >> >> c-ts-mode has instructions in its Commentary, which currently has 3 >> options. The patch removes one of them, leaving these two: > > I don't understand why you decided to treat c-ts-mode differently > from, say, js-ts-mode. I really don't mind removing js-ts-mode, ruby-ts-mode (some other examples?) from being enabled by default. Let's tell the users how to set those up too, it's not hard. We can turn them on later in some future release when we can ensure grammars' availability. And to return to the beginning of your message: > At the very least we should > perhaps have a special user option to tell that. In the simplest case > it should be a simple boolean, but it could also be a list of > languages/grammars for which to enable these modes. Then the relevant > parts of auto-mode-alist should test that variable, in addition to > whether tree-sitter is supported and available in general. This is also a valid approach, albeit a more complex one. This variable would only be tested during Emacs' startup, though, and during 'package-initialize', making its use not very transparent. E.g. we wouldn't react to having it changed in Customize. So it's not my preferred approach to this problem. If we did have such a variable, though, we could enable more modes by default. And it seems like it would be most consistent to enable all tree-sitter modes that we have - including c-ts-mode and so on. I expect some resistance to such a change.