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: Tue, 26 Nov 2024 02:35:16 +0200 Message-ID: <41e2710f-d612-40e2-9037-d8d388c5edc7@gutov.dev> 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> <8734jgftif.fsf@mail.linkov.net> <86ttbwihp6.fsf@gnu.org> <4f8f8b97-6650-4a6f-b121-82964fec49cf@gutov.dev> <86o723ikga.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="26060"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: juri@linkov.net, 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 Tue Nov 26 01:36:20 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 1tFjYw-0006aQ-76 for ged-emacs-devel@m.gmane-mx.org; Tue, 26 Nov 2024 01:36:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tFjY5-0001EM-4y; Mon, 25 Nov 2024 19:35:25 -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 1tFjY4-0001ED-5S for emacs-devel@gnu.org; Mon, 25 Nov 2024 19:35:24 -0500 Original-Received: from fhigh-a3-smtp.messagingengine.com ([103.168.172.154]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tFjY2-0003Us-Hi; Mon, 25 Nov 2024 19:35:23 -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 EBEB61140180; Mon, 25 Nov 2024 19:35:20 -0500 (EST) Original-Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Mon, 25 Nov 2024 19:35:20 -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=1732581320; x=1732667720; bh=/YVFLqGIN2pa6841xMqEKDhtZYWa1xujXREijTnIGo0=; b= IQjcHeIofYzA+x5d7qXnrzjb3zE37yTi7xCgVxZqr8an8uCche7BS9arflNhMJco 89M8bCeeihPXTTGBxtK1UHFACdezrWOpeqrx7ZSyomOq2k59QCG88tMNPINIuMOZ ItJzRreL4y8pbONL80lfEYWLhganCR5zo4AA0jrtuzo99Aj5DazYi2kJUSAUjBqD KBfCTcDP0srP0z3rl0QZz+0yvPI5MgGDUerYVxBwrOvehtwTyRT3H1RT+Y79akpt +lmzSW5pTAi9Tr5nJx+spEM0QxXeRzxg9wkEmeYvxgqnVPniFQW2WvICerim22rb 4HvCw1Pv8SAy6ClrJC3ejw== 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=1732581320; x= 1732667720; bh=/YVFLqGIN2pa6841xMqEKDhtZYWa1xujXREijTnIGo0=; b=G tfkkQf4T+9kn8Mz9VCYMISBnZtsENzbZWFA0VMh71xP3v5WAoWoGJPSvTy0fQuRb RqmzzSNLR2pw7ifZH+kYDeOu/nAhw6twfAJD+2//MAjggVqtgb6cGRt+zNQErRR2 l772fPYvqJj0DMF0JUQ3SY9F3D4BPO/Rfs565kpmSrodlsp49TlabCCZ+b/vMkpk zl8J9HFvm7nfb/YoNUfPofS3x+3ZcMSTPoivlM/PCyFGJ3TU7kKoVAO2Pr66TTDP WB+mYCSO19gSnOs2+jajp27rR2wkjrrt5DyZEGJhT49molyN3DsS+s0KQ9inrEtP b8QkjOS+aswanjtoo0RIg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrgeeigddvvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeen ucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvg hvqeenucggtffrrghtthgvrhhnpeetudeljeegheetgfehgeejkeeuhedvveeikeeufedt vddtveefhfdvveegudejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvhdpnhgspghrtghpthhtohep gedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepvghlihiisehgnhhurdhorhhgpd hrtghpthhtohepjhhurhhisehlihhnkhhovhdrnhgvthdprhgtphhtthhopehjohhhrghn rdhmhihrvggvnhesghhmrghilhdrtghomhdprhgtphhtthhopegvmhgrtghsqdguvghvvg hlsehgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 25 Nov 2024 19:35:19 -0500 (EST) Content-Language: en-US In-Reply-To: <86o723ikga.fsf@gnu.org> Received-SPF: pass client-ip=103.168.172.154; envelope-from=dmitry@gutov.dev; helo=fhigh-a3-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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:325702 Archived-At: On 25/11/2024 14:09, Eli Zaretskii wrote: >> Date: Mon, 25 Nov 2024 02:44:52 +0200 >> Cc: johan.myreen@gmail.com, emacs-devel@gnu.org >> From: Dmitry Gutov >> >> On 24/11/2024 20:56, Eli Zaretskii wrote: >>>> major-mode-remap-alist: >>>> INS DEL Key: js-mode >>>> Value: js-ts-mode >>>> INS DEL Key: ruby-mode >>>> Value: ruby-ts-mode >>> In addition, I personally find this UI quite perplexing, and kinda >>> doubt users who use it will understand what "Key" and "value" mean in >>> this case. >> >> We could add more detailed annotations to those customization fields, so >> it could look more like this, for example: >> >> Major Mode Remap Alist: >> Repeat: >> INS DEL Cons-cell: >> Mode to map from: js-mode >> Function to call instead: js-ts-mode > > I think this would be a big step in the right direction. > > Bonus points for replacing "Repeat" and "Cons-cell" with something > more user-friendly, like "Set of remappings" and "Remap", for example. Maybe like this: Major Mode Remap Alist: List of remappings: INS DEL Remap: From major mode: js-mode To mode (or function): js-ts-mode diff --git a/lisp/files.el b/lisp/files.el index 9c105dbe1a5..879faa563ad 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3606,7 +3606,10 @@ major-mode-remap-alist FUNCTION is typically a major mode which \"does the same thing\" as MODE, but can also be nil to hide other entries (either in this var or in `major-mode-remap-defaults') and means that we should call MODE." - :type '(alist (symbol) (function))) + :type '(repeat :tag "List of remappings" + (cons :tag "Remap" + (symbol :tag "From major mode") + (function :tag "To mode (or function)")))) (defvar major-mode-remap-defaults nil "Alist mapping file-specified modes to alternative modes.