From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Turning on/off tree-sitter modes Date: Sun, 24 Nov 2024 19:29:44 +0200 Organization: LINKOV.NET Message-ID: <8734jgftif.fsf@mail.linkov.net> References: <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> <8b907a41-aa08-4b61-bced-7d4d3fcef4b2@gutov.dev> <87frnhsvp3.fsf@mail.linkov.net> <0d1e2770-0889-4862-8105-8a5f4631b11c@gutov.dev> <87ed31gku5.fsf@mail.linkov.net> <86plmljbsm.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14015"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: dmitry@gutov.dev, 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 Sun Nov 24 18:47:12 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 1tFGhU-0003Yl-SV for ged-emacs-devel@m.gmane-mx.org; Sun, 24 Nov 2024 18:47:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tFGgo-0005T3-Ha; Sun, 24 Nov 2024 12:46:30 -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 1tFGgm-0005Sl-5x for emacs-devel@gnu.org; Sun, 24 Nov 2024 12:46:28 -0500 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tFGgh-00013R-PT; Sun, 24 Nov 2024 12:46:26 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 8C2DBC0004; Sun, 24 Nov 2024 17:46:18 +0000 (UTC) In-Reply-To: <86plmljbsm.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 24 Nov 2024 10:06:33 +0200") X-GND-Sasl: juri@linkov.net Received-SPF: pass client-ip=217.70.183.198; envelope-from=juri@linkov.net; helo=relay6-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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:325671 Archived-At: >> The answer depends on the purpose of the 'treesit-add-enabled-mode' >> command that I still don't understand. Is it supposed to be used >> in user configs as >> >> (treesit-add-enabled-mode 'ruby-mode 'ruby-ts-mode) >> >> to be another way to do the same as >> >> (add-to-list 'major-mode-remap-alist '(ruby-mode . ruby-ts-mode)) >> >> Or maybe we want to simplify this setting. Then we need >> not a command, but a new option 'treesit-enable-modes': >> >> (add-to-list 'treesit-enable-modes 'ruby-ts-mode) > > When you suggest such ways of implementing user preferences, please > always consider two factors: (a) the complexity from the users' POV, > and (b) the way to undo the preference. > > Using alists or lists for customization requires that users understand > the basics of lists in Emacs, and have good command of the relevant > primitives. As the experience of default-frame-alist suggests, that > is not a trivial thing to master (IMO, default-frame-alist survives > only because most users don't customize it directly, but via > higher-level APIs like set-frame-font etc.). > > Undoing the preferences is also not easy when lists/alists are used, > because there could be more than one element in the list, and it's > easy to forget to remove all of them. The Custom UI helps to avoid such problems with the buttons to add/remove list elements like major-mode-remap-alist: INS DEL Key: js-mode Value: js-ts-mode INS DEL Key: ruby-mode Value: ruby-ts-mode >> > Not 100% sure though - because that plan would delete the vast majority of >> > the uses of the latter from the core (except for TeX's mappings, it seems). >> >> Agreed, 'major-mode-remap-defaults' could be removed when loading a ts-mode file >> will not modify file associations anymore. > > I don't think we can or should remove it, because it's useful for the > cases like the TeX/LaTeX mode (for which we set it up now by default). Agreed, 'major-mode-remap-defaults' should stay to handle rare cases.