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: Make all tree-sitter modes optional Date: Mon, 16 Jan 2023 14:34:09 +0200 Message-ID: <831qnu64la.fsf@gnu.org> References: <84973.1672843723@hassadar.pretzelnet.org> <83wn62xi3k.fsf@gnu.org> <83o7rexe2n.fsf@gnu.org> <83h6x5xym7.fsf@gnu.org> <83h6wr6gmz.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26590"; mail-complaints-to="usenet@ciao.gmane.io" Cc: casouri@gmail.com, monnier@iro.umontreal.ca, larsi@gnus.org, theo@thornhill.no, jostein@secure.kjonigsen.net, emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jan 16 13:35:00 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 1pHOhX-0006fg-VF for ged-emacs-devel@m.gmane-mx.org; Mon, 16 Jan 2023 13:35:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHOgn-0004uM-FB; Mon, 16 Jan 2023 07:34:14 -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 1pHOgg-0004tu-MX for emacs-devel@gnu.org; Mon, 16 Jan 2023 07:34:10 -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 1pHOgd-00048K-P3; Mon, 16 Jan 2023 07:34:05 -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=43LqsdESFnvqFVeIHV/WJ3lMfoJ/mPCAUmXvwsQf5wI=; b=pzvjbJ3DHpcR IWWAYHs0rq8B5rBZ/nhcGav7BwZKcV7NcYX3M066v0rZVwHeYb/RgZ95lJiQGf1pujQGmN0Kwrhx7 tUKUvEMX+aeSglTw4PIZqI15mfboUGQXpOjfbZ9u75seyCahlAgtnS2pSVQSnN0ZIVsB011GVeoVg M+75OPphe/reaeLVsLdR+xKKYolDd4zFZ1p+H8ID6lrjN7dTlpnYYpXaJ2M3QrO8v6ziCnkT0yAIO rjBQ2+LXW/+6zaSYMU8W6UFMW1Z8NnpeseNOt4bfbbDTtoJ2VUw9cUqTdZhLFVn6oL0crrYs2SLh4 ZJY93P86cwsVgqNeTVUVyA==; 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 1pHOgd-0001qW-2c; Mon, 16 Jan 2023 07:34:03 -0500 In-Reply-To: (message from Dmitry Gutov on Mon, 16 Jan 2023 01:39:18 +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:302451 Archived-At: > Date: Mon, 16 Jan 2023 01:39:18 +0200 > Cc: emacs-devel@gnu.org > From: Dmitry Gutov > > On 15/01/2023 16:01, Eli Zaretskii wrote: > > You will > > see that where possible, just loading a TS mode modifies > > auto-mode-alist if the tree-sitter support for that mode is available, > > whereas for other modes auto-mode-alist is modified only when the mode > > is actually turned on successfully for the first time. This is > > because some of the TS modes have their own *.el files, whereas others > > share a .el file with other modes, and so loading that file doesn't > > necessarily means the user wants to use the tree-sitter based mode. > > If we *are* going to do this (make all ts mode strictly optional), I > don't think either of this is a good idea: for a given foo-ts-mode, the > user might already have an auto-mode-alist entry configured with another > mode (third-party or not), and they will likely 'M-x foo-ts-mode' to try > how well it works (or doesn't). > > Having auto-mode-alist modified automatically can come as a surprise > either way. > > Note the this is different to having the auto-mode-alist entries set up > from the outset, because the user's alterations override those. > > We can drop the auto-mode-alist alterations from ts modes altogether, to > bring them back when we do decide to enable them by default. Like I said: this is not ideal. So I'm not surprised that whatever we do, there can be usage scenarios where what we do will annoy someone. That said: . The proposed patch made many changes of auto-mode-alist conditional where they previously were _un_conditional. I submit that this is less annoyance in the important use case where the tree-sitter or the grammar library is not available. There are indications that this situation will be frequent enough when Emacs 29.1 hits the street. . I don't buy the assumption that customizations of auto-mode-alist are frequent enough to make that an important factor in these decisions, let alone suggest that users should always do that if they want to try the *-ts-* modes seriously: - IME, auto-mode-alist is relatively rarely customized for modes that are included in Emacs (e.g., I don't customize entries of any such modes), for the simple reason that it is very rarely needed. - Customizing auto-mode-alist is not the easiest task, it requires good knowledge of Emacs regexps and alists. So asking anyone who wants to try using the tree-sitter modes to do that is not the best idea from the POV of user-friendliness. - OTOH, I'm quite sure that people who do already customize auto-mode-alist for built-in modes are more advanced users and will be able to overcome any problems that could be caused by modifying auto-mode-alist as side effect of activating the mode. . Last, but not least: I think someone who turns on a tree-sitter mode in some buffer is much more likely to want to use that mode in more than that single buffer than the other way around. And if for some reason they are disappointed soon enough, just restarting the Emacs session will get them back the old behavior. Which again tells me that if we accept your proposal, we will annoy more users (with the need to modify auto-mode-alist) than under my proposal. So, on balance, I think what I proposed is better than what you propose.