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: Thu, 28 Nov 2024 20:50:27 +0200 Message-ID: <771f99be-efb9-44b2-9f3a-726336f25889@gutov.dev> References: <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> <41e2710f-d612-40e2-9037-d8d388c5edc7@gutov.dev> <86ldx6gjai.fsf@gnu.org> <878qt588qb.fsf@mail.linkov.net> <277bed39-bad3-4464-8ca8-506428a5ba2e@gutov.dev> <878qt36a69.fsf@mail.linkov.net> 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="19727"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: Eli Zaretskii , johan.myreen@gmail.com, emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 28 19:51:29 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 1tGjbs-00050D-52 for ged-emacs-devel@m.gmane-mx.org; Thu, 28 Nov 2024 19:51:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGjb9-0005fY-JY; Thu, 28 Nov 2024 13:50:43 -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 1tGjb3-0005fQ-0J for emacs-devel@gnu.org; Thu, 28 Nov 2024 13:50:37 -0500 Original-Received: from fhigh-b7-smtp.messagingengine.com ([202.12.124.158]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGjb0-0002oP-VA; Thu, 28 Nov 2024 13:50:36 -0500 Original-Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfhigh.stl.internal (Postfix) with ESMTP id B8D6C25401DD; Thu, 28 Nov 2024 13:50:31 -0500 (EST) Original-Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-08.internal (MEProxy); Thu, 28 Nov 2024 13:50:31 -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=fm3; t=1732819831; x=1732906231; bh=bgUAGI0aQRamOwa8OfPm1BSSc1+r04GerxvvfBNs3Hk=; b= VWljYHrMgwI+fKjg4FMNx9x7bQhH57vFE+RQaERBeys0LGAJLZhTs3NPx6bICiNP Wp37/MCgnzHfCE2lfopIjeCqLy4oG4aJt6dx3XsS4ZnCS0h2uIDcREV7WM9sZR+S dDljJhmI6VZ97iDO4b86tUqmXVKjR+Al4MnPdeeUqgEwwnfUob5MGkzsKoB4SrMJ Ey71VLkir4vh2J1KCTgsd3N+xh53wIXKQ8sYWlPLK14joyjCTvcCBapD3IAHAOvx AaRDbE17kRVQ0jh9IbZv66eR8NszWGrlrtot6+7OH3Wt8xLzXaLWfGHEGmrXYzJi zPLfNKhLS0OK0qiHVz8Zfg== 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=1732819831; x= 1732906231; bh=bgUAGI0aQRamOwa8OfPm1BSSc1+r04GerxvvfBNs3Hk=; b=3 RaVOHkkV0X6jCAufD+BZ4X1CLnKQRmdg5GbkV+3T6xzlUb4ppisiFRkV0a4Vkuv2 jWTu+bcbXScWhacUgyfdkOzY/fOgt652xABgh7tuY03ymC/ebUd9TZWQNT+lSdy3 iKivhrVhBhsgpxCooxxJ8L9QQhytr6R3hNxBXyuc7YhxPgh3ojMPwvD03OoJzSN4 SYKsoNgF7DCGCa4ruNuWUyeaDmjz9DJSJfr2uqyXOSOoUZzNVFW/vtQZ7vSJn1c/ ijVlu7sF8s3JQVzc+adFBC9hZrXujhNBmIVxFYV+TlZvj5vn6s5LF9HIC3p29hSu oiUvx3TO6xxgBzUEmiIxg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrhedugdduudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdej necuhfhrohhmpeffmhhithhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdrug gvvheqnecuggftrfgrthhtvghrnhepteduleejgeehtefgheegjeekueehvdevieekueef tddvtdevfefhvdevgedujeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepughmihhtrhihsehguhhtohhvrdguvghvpdhnsggprhgtphhtthho peegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehjuhhriheslhhinhhkohhvrd hnvghtpdhrtghpthhtohepvghlihiisehgnhhurdhorhhgpdhrtghpthhtohepjhhohhgr nhdrmhihrhgvvghnsehgmhgrihhlrdgtohhmpdhrtghpthhtohepvghmrggtshdquggvvh gvlhesghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 28 Nov 2024 13:50:29 -0500 (EST) Content-Language: en-US In-Reply-To: <878qt36a69.fsf@mail.linkov.net> Received-SPF: pass client-ip=202.12.124.158; envelope-from=dmitry@gutov.dev; helo=fhigh-b7-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:325830 Archived-At: On 28/11/2024 09:58, Juri Linkov wrote: >>>> I'd prefer >>>> >>>> Major Mode Remap Alist: >>>> List of remappings: >>>> INS DEL >>>> Remap from major mode: js-mode >>>> To mode (or function): js-ts-mode >>> Here mode names are nicely aligned, >>> so it's easier to read for users. >> >> I think the forms for alist's values are extra indented intentionally. But >> it's not the best for aesthetics, I suppose. > > I don't know why there is extra indentation in widget. > If offset is reduced from 12 to 9, this provides > better aesthetics with: > > diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el > index ba99847f488..bc12e26ac22 100644 > --- a/lisp/wid-edit.el > +++ b/lisp/wid-edit.el > @@ -2862,7 +2865,7 @@ 'editable-list > "A variable list of widgets of the same type." > :convert-widget 'widget-types-convert-widget > :copy 'widget-types-copy > - :offset 12 > + :offset 9 Maybe 10? With 9, it still doesn't line up on my display (the buttons' margins drive the offset), but hangs over for like 0.5 character width. With 10, the result look more intentional, though I'm not sure if the original plan (in Emacs 25?) was to have a different indentation or not. > :format "%v%i\n" > :format-handler 'widget-editable-list-format-handler > :entry-format "%i %d %v" > diff --git a/lisp/files.el b/lisp/files.el > index a65bc4a4ea2..7ac22eac2fb 100644 > --- a/lisp/files.el > +++ b/lisp/files.el > @@ -3621,10 +3621,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 > - :tag "Remappings" > - :key-type (symbol :tag "From major mode") > - :value-type (function :tag "To mode (or function)"))) > + :type '(alist :key-type (symbol :tag "Remap from major mode")) > + :value-type (function :tag "To mode (or function)")) > + :options '((js-mode (function :value js-ts-mode)) > + (ruby-mode (function :value ruby-ts-mode))) This :options hunk is a nice illustration, but if it's a serious proposal I wonder which set of modes would be appropriate to have here. All or most ts modes? Note we still won't be able to cover all tree-sitter modes this way because a large part of them doesn't have any corresponding "traditional" modes and so no existing auto-mode-alist entries.