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: Turning on/off tree-sitter modes Date: Sat, 23 Nov 2024 18:26:21 +0200 Message-ID: <8b907a41-aa08-4b61-bced-7d4d3fcef4b2@gutov.dev> References: <6ac73c67-cb2d-48ef-8f1d-683c5335aba5@gutov.dev> <8634k4s2r2.fsf@gnu.org> <082b0388-b3a1-4523-9f9b-5ead4b110e11@gutov.dev> <86plmrtemx.fsf@gnu.org> <7aa4a684-3374-4d0f-8efc-c4df29337c5e@gutov.dev> <86cyirtahu.fsf@gnu.org> <556779b3-9308-4fd3-9050-bf9c49658cd1@gutov.dev> <864j43t8t9.fsf@gnu.org> <4cc676e8-cac5-4348-99b0-243baf74687e@gutov.dev> <8634jnt5e3.fsf@gnu.org> <4864104c-cb23-4356-ad89-2fea111db66c@gutov.dev> <86ttc2rrh8.fsf@gnu.org> <86cyipsp94.fsf@gnu.org> <9cd17f8b-f88c-49f6-9024-0b6d297e18ac@gutov.dev> <867c8xsmri.fsf@gnu.org> <566ac897-ea5e-4141-bcb3-306d43c9118a@gutov.dev> <865xohrvfa.fsf@gnu.org> <86wmgwnyle.fsf@gnu.org> <178dfc7f-bc2d-4e3b-8417-a616ccc0eef3@gutov.dev> <86v7wgnxlz.fsf@gnu.org> <01d83ec8-c02b-4806-8764-38dc89a89125@gutov.dev> <86ttbzojho.fsf@gnu.org> <930f5c8e-1481-43a5-8f1d-2c13a98df74f@gutov.dev> <86r072krq5.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="1341"; 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 Sat Nov 23 17:27:30 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 1tEsyn-0000BI-CI for ged-emacs-devel@m.gmane-mx.org; Sat, 23 Nov 2024 17:27:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tEsxr-00016Y-AV; Sat, 23 Nov 2024 11:26:31 -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 1tEsxp-000163-Rp for emacs-devel@gnu.org; Sat, 23 Nov 2024 11:26:29 -0500 Original-Received: from fhigh-a8-smtp.messagingengine.com ([103.168.172.159]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tEsxn-0006Ik-Ue; Sat, 23 Nov 2024 11:26:29 -0500 Original-Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id 607E41140154; Sat, 23 Nov 2024 11:26:25 -0500 (EST) Original-Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Sat, 23 Nov 2024 11:26:25 -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=1732379185; x=1732465585; bh=P1HYMjGWuLsZMzw2if3mt9bbGmoUcUEFhofmrwjhe7A=; b= eUTdKdNuAg8S4giqLZUVbvIUmRrIk+h5AeK9jNoIuHp3j4ZRydfSBY28+wL8+Y6j 7Mjw9GY8bBL2YI2ZDPVNDm1ctzmIF0Qfu2qCbQvdwG8dM3cSd2fiTc4QjLUekAYr J1aQZAXJ8s9WUf/RwHg7qNn6pViLXnYgC8Q/ZE9TIbem3s9az+7otqDKJn1HFePE k058BhIbx81jGvWsVm+TZxw6qVx+gbAwysAZlUaYtZmvsvfYgOC+e/PrMpnt14Nz UwYQseQtqf+/7dIY6wyvPXh2WIJZDLu3CRVTC4fLt8PJuhFgADYN8YFdaoGfktuL D70e6RCELExFLGZaJY8MBQ== 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=fm1; t=1732379185; x= 1732465585; bh=P1HYMjGWuLsZMzw2if3mt9bbGmoUcUEFhofmrwjhe7A=; b=a Iz6bKXsK1coZ3Czd8J++xCZOlNVBw3EzXbJxyUwu/rw8j1b75OVhBjRt9teQKztS k11v6vck2hjiRT5XEEMJOKJlAjYOS//Hw/W7EScS2EWAmVapZWCgvZf8jFgexoYO tjisCyDUc0552+0QYhCg6u94xaH3z1tnp+D0A3UlrTnhUGjpoCxWue2RaW8QwjwH pCAP/P1QB6pX8vR/8/94B6iQG6aONNhMUv/COJdu1wr61kiFYms5AjxFULf/oQNT cscjCFgya4RQRIeO8C3ruq14fSmu5oK316ncOVnLSfS5zkjDvcFYoTrlAUhTHpVx HZxbNX5gIx3pNZV6sWzzg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrgedugdekkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeen ucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvg hvqeenucggtffrrghtthgvrhhnpeetudeljeegheetgfehgeejkeeuhedvveeikeeufedt vddtveefhfdvveegudejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvhdpnhgspghrtghpthhtohep fedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepvghlihiisehgnhhurdhorhhgpd hrtghpthhtohepjhhohhgrnhdrmhihrhgvvghnsehgmhgrihhlrdgtohhmpdhrtghpthht ohepvghmrggtshdquggvvhgvlhesghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 23 Nov 2024 11:26:23 -0500 (EST) Content-Language: en-US In-Reply-To: <86r072krq5.fsf@gnu.org> Received-SPF: pass client-ip=103.168.172.159; envelope-from=dmitry@gutov.dev; helo=fhigh-a8-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_MSPIKE_H2=-0.001, 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:325627 Archived-At: On 23/11/2024 15:24, Eli Zaretskii wrote: > [I've started a new thread about this.] Nice. >>> Another thing that seems to be missing is a command >>> to enable just one TS-based mode, not all of them. >> >> How about if that's done like: >> >> (setopt treesit-enable-modes '(c-ts-mode)) >> >> Or maybe 'M-x treesit-add-enabled-mode' can be added too. > > I think a command is better. Okay. It can read the mode name with completion, and then call (setopt treesit-enable-modes (cons new-mode treesit-enable-modes)) > Here are the issues that are currently not handled by your patch, > which perhaps require modifications and additions (but should probably > be discussed first): > > . we need the ability to turn on and off selected TS-based modes, > and do it easily Note that we don't have such capability currently. I guess we could add 'treesit-remove-enabled-mode', implemented almost exactly like the above. Both commands would be pure wrappers on top of the user option, so they don't seem to require any advance considerations. Somebody can add those later, or any variations on them. > . we should include in this feature handling of all the TS-based > modes in core (right now, I don't see python-ts-mode, > ruby-ts-mode, and csharp-ts-mode, at least) Sure. The patch was basically abbreviated for easier reading. > . we should decide how to handle TS-based modes whose non-TS > counterparts are available as 3rd-party packages I think we shouldn't do anything about those - they will continue to use the current policy for 3rd party major modes: installing a package adds an 'add-to-list' form to autoloads, which runs during package-initialize. To disable such a form, the user uninstalls a package. > . we should decide whether we want to modify auto-mode-alist or use > major-mode remapping for all the TS-based modes I see no reason to depart from the current approach - except I've switched from major-mode-remap-defaults to major-mode-remap-alist (where the former is used) because the latter corresponds to user preferences, and it seems like that's the subject of our switcher. This could also be discussed, but seems more of an orthogonal issue.