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: Make all tree-sitter modes optional Date: Thu, 16 Feb 2023 21:14:02 +0200 Message-ID: <60330002-1800-7e50-e95b-22abf0591b4f@yandex.ru> References: <83o7rexe2n.fsf@gnu.org> <83h6x5xym7.fsf@gnu.org> <83h6wr6gmz.fsf@gnu.org> <868ri140sr.fsf@mail.linkov.net> <83fsc92gbz.fsf@gnu.org> <83cz6ccagy.fsf@gnu.org> <838rgzaqmj.fsf@gnu.org> <7bad77ae-a176-d49b-5115-dbadf7e6d1bc@yandex.ru> <83cz6aaeys.fsf@gnu.org> <837cwiae2c.fsf@gnu.org> <83r0uq839h.fsf@gnu.org> <83pma939c4.fsf@gnu.org> <83ilg135ie.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="15029"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Cc: acm@muc.de, juri@linkov.net, casouri@gmail.com, larsi@gnus.org, theo@thornhill.no, jostein@secure.kjonigsen.net, emacs-devel@gnu.org To: Eli Zaretskii , Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Feb 16 20:15:01 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 1pSjie-0003jw-N2 for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Feb 2023 20:15:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSjhw-0007iV-PC; Thu, 16 Feb 2023 14:14:16 -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 1pSjhp-0007ez-LW for emacs-devel@gnu.org; Thu, 16 Feb 2023 14:14:12 -0500 Original-Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pSjhn-0001dt-Lq; Thu, 16 Feb 2023 14:14:09 -0500 Original-Received: by mail-ed1-x529.google.com with SMTP id a10so6675930edu.9; Thu, 16 Feb 2023 11:14:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=12MMU5CqAVC2ehiPtz2dtUTtX8GhGIwkriekB5lKdNY=; b=IXQJ8Qqpi3B/R5T2xUUyaOFnScdSqUipM93rFaacWrBWTv+f5V497rXgoJq+AhDAuZ YnkcUKpdElQp0FBWOCpBQVAC7FQSp2WlDNZX2DWXA51p2JvFYhAV5Apx7v+J6R20j9A9 Vwj6jth17Q/lvNpodybKoSIK2lE3f5CVsGGnaNGT5jAz5qSacgf4eM9h3thqNaKJliRf NSGAIDwuTV391NsmY8zNu9SAMLe4ongS9gOWXSDEErC48jojYj2moidovGv6J0Lu3hJ8 4NmllEHRbPDMgx3Vh25PTcundEqeUBsCuBOu+K96lkf88eZBBWhfHMtujFqdCTc+ZrKv U0HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=12MMU5CqAVC2ehiPtz2dtUTtX8GhGIwkriekB5lKdNY=; b=Bv0q6Z/M8mN7OvzoP8KIrEEsgkTdGCRyqjokwsjQ5p+ND6t/S2nQWc5WiuatwISIdW LEb4TXmNoZ1lQaaNUnINMUVWMCKebWY8xHfvcfLe8n70Ll0l8kAZF9XgPj0jrmDfWDuC 5MBtmb4zY+68O0+zyeWJRahrZbap/sCgOgwQthpoT3KGlOWhLBOm+fiCuYUIhpJQqV3f SQFm/DIi1tPBBPM7kqPAIrFoXF/6t2K+TvRPcXH2A3XPIfMEx5NNwP2ODJsK12fYOBDy r1SvCopWOG+QLZCVT86hHbD8yiKJm0IhU5OZ8Mu8pI1LoLl8uIIyc13yqSgDQp5qBdb2 mFbA== X-Gm-Message-State: AO0yUKUw5zf26uWDgNRQS+6/ljnhUXI4OOzwxCUbQ8EJx6xkelPjFxJ4 vTBiobSjOPeor5LUSJ92cYRecDzkjfg= X-Google-Smtp-Source: AK7set/YBEJQR2PevSK1cMU9eaQpgcjhGOKbvo9/SkmqZJUUjYniDHptkiLnZ0QQc57J8nGMggFTuQ== X-Received: by 2002:a05:6402:517:b0:4ad:7301:fe73 with SMTP id m23-20020a056402051700b004ad7301fe73mr1638817edv.7.1676574845154; Thu, 16 Feb 2023 11:14:05 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id s24-20020a508d18000000b004acb2c8aeaesm1294728eds.85.2023.02.16.11.14.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Feb 2023 11:14:04 -0800 (PST) Content-Language: en-US In-Reply-To: <83ilg135ie.fsf@gnu.org> Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=raaahh@gmail.com; helo=mail-ed1-x529.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-0.351, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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:303432 Archived-At: On 16/02/2023 19:05, Eli Zaretskii wrote: >>>> But with my patch, trying the modes is exactly the same (just `M-x >>>> c-ts-mode`) and turning them on in their customization is no harder >>>> (since `(c-ts-activate)` is no harder to type than `(require >>>> 'c-ts-mode)` >>> Sorry, I don't buy this argument. >> Care to expand a bit more. > I don't agree that calling (c-ts-activate) in an init file is no > harder than loading a package. For you and me, maybe, but not for > users. Loading a package is easy. But what happens after the user decides they like the new major mode and want to use it in every session? They will need to add something to their init script. And at that point, (require 'c-ts-mode) is not particularly easier for a newbie than (treesit-setup-mode 'c-ts-mode) Or (treesit-setup-mode 'c), or (c-ts-activate), or whatever. >>>> we could also make it a global minor mode so it can be >>>> done via Custom if it's considered important). >>> This was considered already, but had its own issues. >> Can you mention at least one? > Sorry, I remember only the conclusion. You will have to look up the > discussions. (And you were here when they happened.) It has been my impression that you made up your mind pretty early on, so I didn't even try to get into the discussions for the technical solutions, but (*) >>> We'll have to make this one exception to the rule. The situation >>> itself is exceptional and probably won't happen again soon, if ever. >> I understand there's time pressure. But I think this would argue >> towards making the code more conservative (e.g. not change the defaults >> at all, not even after enabling `c-ts-mode`) since that's much less >> likely to bring problems now and in the future. > That'd make it significantly harder for users to try these modes, so I > cannot agree to that. To try a major mode like that, the user can 'M-x c-ts-mode' either way, no matter the solution we choose. >> I think if we want a quick&dirty short-term way to encourage the use of >> tree-sitter by enthusiastic users, we should provide a "one stop shop" >> function which redirects all applicable major modes to their tree-sitter >> variant. > That, too, was suggested a couple of months ago. It has a > disadvantage of blindly assuming that a given user will either want > all of the TS modes or none of them. It also assumes that a given > user has all of the grammar libraries installed. Both assumptions are > not necessarily true, and so I decided that we must allow the users to > make separate and independent decisions for each such case. (*) If you prefer the users enable the modes one-by-one, we can provide a helper to do just that. Like in the example above, it could be called 'treesit-setup-mode' and could accept as an argument either the major mode name, or a language, and set up the necessary auto-mode-alist or major-mode-alist-alist entries.