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: An anonymous IRC user's opinion Date: Mon, 04 Nov 2024 14:11:29 +0200 Message-ID: <865xp3w64u.fsf@gnu.org> 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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37753"; mail-complaints-to="usenet@ciao.gmane.io" Cc: johan.myreen@gmail.com, emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 04 13:12:15 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 1t7vwN-0009eB-N2 for ged-emacs-devel@m.gmane-mx.org; Mon, 04 Nov 2024 13:12:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t7vvm-00039w-G2; Mon, 04 Nov 2024 07:11:40 -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 1t7vvi-00039C-Fh for emacs-devel@gnu.org; Mon, 04 Nov 2024 07:11:34 -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 1t7vvh-00060m-JG; Mon, 04 Nov 2024 07:11:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=eu8yk8VuEx0/ky1SOVXJ7V6iSq0/qv+VuUuXPrlW63M=; b=fVTBz2rWH0sw VY+9anw5bYX9bJAxnIHIy1Wq3t/Msroig6PY6/S2wjx4C8JTR99GV8tc4cDCejngTru3NWlEjxrDL at8FlGwWS8EQBQUGPWAoIBm0x8aeSd902qoZWmVnmDWuzj9FbyZL9cbWvmG1J0LGdkoFpQGx+pEtQ OeidWOAUU4vvCzfIyMfdwR/2mBtzn0JJm9h63xAbHJsAu/LME6mlp6Jh5hMc5VOqwpkS63G9RWxIG Hdrniv4q/mYQOzBwM/eHYTPSlTw0SGLQC4AE0y7qHH8b4m9z/HSzS9h+GFtv4VkN769Yg+xstOqre 6feVVq7y/fTt4QEohitYKA==; In-Reply-To: (message from Dmitry Gutov on Sun, 3 Nov 2024 21:24:27 +0200) 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:325094 Archived-At: > Date: Sun, 3 Nov 2024 21:24:27 +0200 > Cc: johan.myreen@gmail.com, emacs-devel@gnu.org > From: Dmitry Gutov > > As long as Emacs is configured with support for tree-sitter, we enable > file associations (using auto-mode-alist) for a certain set of > tree-sitter based modes. Chefly those that don't have existing > "traditional" modes, but that's debatable. > > For others (modes that are not enabled by default), we document the way > to enable them somewhere - in packages' Commentary, for example. The > traditional way to do that has been with us for decades (people need to > add an auto-mode-alist entry in their config script) - and now we also > have a way to do that using major-mode-remap-alist. Either way, adding a > line or two to their .emacs. > > The overall effect is that the file associations become stable again: > set during Emacs's startup and not changing when a package gets loaded, > or a major mode function is called. > > > Is the idea to expect the users to have all the grammar libraries > > installed when they use an Emacs which was built with Tree-Sitter? > > In a way yes, but also no, because they are only needed when the > corresponding file is visited. And only for modes that we decide to > enable by default. I'd prefer not to assume that the mere presence of libtree-sitter means the user wants to use modes. 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. > > 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? This is not a marketing stance, is it? > > 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.