From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Turing on tree-sitter Date: Mon, 10 Oct 2022 09:06:29 -0700 Message-ID: <434B99AD-F307-492A-8E9A-27C84CC575B0@gmail.com> References: <83czb1jrm3.fsf@gnu.org> <87v8ot2nfi.fsf@posteo.net> <837d19jfia.fsf@gnu.org> <83edvgi3mx.fsf@gnu.org> <87r0zg5g76.fsf@thornhill.no> <78205E8D-B2D4-4460-BE0A-9BF7C627A79B@gmail.com> <87zge4b0lc.fsf@posteo.net> <83zge4gk9z.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17377"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Philip Kaludercic , theo@thornhill.no, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 10 18:23:24 2022 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 1ohvYp-0004F1-QP for ged-emacs-devel@m.gmane-mx.org; Mon, 10 Oct 2022 18:23:23 +0200 Original-Received: from localhost ([::1]:36030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ohvYo-0001pC-Cl for ged-emacs-devel@m.gmane-mx.org; Mon, 10 Oct 2022 12:23:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44854) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohvId-000336-CK for emacs-devel@gnu.org; Mon, 10 Oct 2022 12:06:39 -0400 Original-Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:37760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ohvIb-0005Np-P7; Mon, 10 Oct 2022 12:06:39 -0400 Original-Received: by mail-pj1-x102a.google.com with SMTP id p3-20020a17090a284300b0020a85fa3ffcso13488612pjf.2; Mon, 10 Oct 2022 09:06:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=k4Bwt7f7Yff881zwiPCC/AQT1TwQPK8VjBFWp3JGQmE=; b=guqcyVrLsn0IJWoihAJylyv2JE9iUSgBZUdLdAf3E7rym3IyJN2OrcxcCE14ICGmsj L+hl5HUv0Dc7tQnPibqgDTyuaEf/xExmgcx/tqDUIYjEH5FjpHiQTFSmxmoCvN2QzY7l GeUSE0qvwBT9DHNB7fiYgSE9es8ZxAqQZl2mbXL/MEWZIUDaf8uoZDmmzsNKwF96Xw9g oeY2ZL9wqW98IXDg6WCDTWNjozuRq2MzviPxl0H3DchjoeumX9ycW4Hoq2SUPberp75s Holi4Iyxc19lLXrgspiPamRdo0T4HGtUbJk5XqMJ+ODClrsWqUqinZJ2EhWG57U3geDp NJyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k4Bwt7f7Yff881zwiPCC/AQT1TwQPK8VjBFWp3JGQmE=; b=QtCggOo6ref4NmJyDasOB5yJUkgd/IrFP7EOrMRqF5bGjLp8xCiBONnR5M7p8V0O9f mzagFxeUCoJDHL0pzJBL79Wprzt1OpSK0zFqSeWkLxy7uuTF7lajgAB8QrIRxM5wiQTS N1YfpLf+0a/sw+ddr1JHto8gX6HqcHqWz8clsJOqsXb9OEElyr6TAJqii/7WU8fXLmyB epR+kX/0DU+1WPx/VItKaPbDRthyARV5zPsOToQq11l+OPHELu0QF8rPmkNtZMnW+gIg 0eF2dqSd6keyyxznfRcntK/XnUdCFAYDyea4JiBD8Gy8Jw4o2aaX8vhdAHPzSJXfFCEl jijw== X-Gm-Message-State: ACrzQf3PSl07b0MpCSgTYaGwLnj0Rf+FDHK9Sq7wlmEwtY1yolW0zb0O S7Z/Vq1YVyjf8yLslwlPW+I= X-Google-Smtp-Source: AMsMyM5/4uutPyXcrOs0hJYB8u+po1AsxuvMQSiKYUNObPT11/4479n11B+5V2+VEIzAgiOG9T4abw== X-Received: by 2002:a17:902:748b:b0:181:3fae:9b95 with SMTP id h11-20020a170902748b00b001813fae9b95mr11129286pll.24.1665417992670; Mon, 10 Oct 2022 09:06:32 -0700 (PDT) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id w18-20020a170902c79200b00174be817124sm6779416pla.221.2022.10.10.09.06.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Oct 2022 09:06:31 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=casouri@gmail.com; helo=mail-pj1-x102a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, 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" Xref: news.gmane.io gmane.emacs.devel:297381 Archived-At: > On Oct 10, 2022, at 7:52 AM, Stefan Monnier = wrote: >=20 >>> Is there a reason we can't use a minor mode? Something like >>>=20 >>> (add-hook 'python-mode-hook #'treesit-mode) >>>=20 >>> or a list >>>=20 >>> (add-to-list 'treesit-modes 'python-mode) >>>=20 >>> ? >>=20 >> We could, if a minor mode is justified. When this was previously >> brought up, someone said the justification for a minor mode was too >> weak in most cases. But maybe we should revisit that idea. >=20 > I think a buffer-local `treesit-mode` plus a `global-treesit-mode` = would > make a lot of sense, from a user's perspective. This way they don't > have to hunt for the name of the boolean variable that their mode > decided to use to control the use of treesitter: all modes use the = same > boolean variable called `treesit-mode`. Usually users set buffer-local variables in a major mode hook, which = runs after the major mode is loaded, no? But major modes need to know = whether to use tree-sitter up-front. I don=E2=80=99t think xxx-mode-use-tree-sitter would be hard to find if = every mode uses this pattern. Though now we are discussing adding = separate major modes which wouldn=E2=80=99t use this variable. I think = that indeed could be confusing. (How do I know if xxx language uses = xxx-mode-use-tree-sitter or a separate major mode xxx-tree-sitter-mode?) >=20 > Then again, to me a minor mode is something so cheap that the idea = that > "justification for a minor mode was too weak" is rather hard to grasp. I don=E2=80=99t think there is too much problem using minor modes, but = minor modes wouldn=E2=80=99t fit very well with separate major modes. = IMO it would be weird if turning on tree-sitter-mode changes the major = mode. Yuan