From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Average-user-facing interface for tree-sitter Date: Thu, 13 Oct 2022 08:22:53 +0200 Message-ID: <87ilko9r9e.fsf@gnus.org> References: <3A7E7CD1-74A7-4352-9DFE-FC982EAA398E@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38205"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Oct 13 08:25:25 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 1oirem-0009kn-O7 for ged-emacs-devel@m.gmane-mx.org; Thu, 13 Oct 2022 08:25:24 +0200 Original-Received: from localhost ([::1]:43388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oirel-0005tC-LB for ged-emacs-devel@m.gmane-mx.org; Thu, 13 Oct 2022 02:25:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oircS-00059e-8l for emacs-devel@gnu.org; Thu, 13 Oct 2022 02:23:00 -0400 Original-Received: from quimby.gnus.org ([2a01:4f9:2b:f0f::2]:49094) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oircQ-0002Fk-QR for emacs-devel@gnu.org; Thu, 13 Oct 2022 02:22:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ANZT47ru2BuO1rhrgL3VNR4O/H6HzUKF9gNDcUmuPqE=; b=GNyz51ngj7CjMUE0A41xmd545S LDX89hjUl8FMNSGlljk311kfPaixtCYgg3Zn/JgfH7gsKHMDhfM1gsoStnmM1Ieykw5/gwDwsI8mC M2DDsEXPkJLCCLkYQer4QFd79cY3h9nI++GOGrLJJzUj0FBFEVwPZmixF/rgettQndiM=; Original-Received: from [84.212.220.105] (helo=downe) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oircM-0005Fm-2j; Thu, 13 Oct 2022 08:22:56 +0200 In-Reply-To: <3A7E7CD1-74A7-4352-9DFE-FC982EAA398E@gmail.com> (Yuan Fu's message of "Tue, 11 Oct 2022 23:11:27 -0700") Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAGFBMVEXT1dSztbSeoJ+Y mpmdn56+wL+/wcD////N7HCyAAAAAWJLR0QHFmGI6wAAAAd0SU1FB+YKDQYQHZlakHkAAAEhSURB VDjLzZPdkYQgDMfDznDPBHTfGbYBZBvwowC9CrT/Ji6R9QxoAZs8OORniEn+Any52ej8bTj0rrsi 9Y6v6AY3mjL+6KcYdtCUZOxTHGN4u9R0RUKKBDoGLskUtB699Zaevx5FZYPsLbYKyc8UBQwUOwE4 wQYLqAye0AqAhNRK4VkbeAIKoNhXCrOjqMGujYKfjM6MZUdQZxxXKQ7f1LhmzKBPsNLh30RBfkUC yOdqG3TUShFZwcwgrjJlcVV/1bXz9oP2cEvdHrYcI5l1brGY7sxj13yR7FzsowSUkwGXq1e7XVeb xXAAIQZAAiwgtPjATSq380PW7mRDMa/gp4+obSFReMRd1J2bXDXg7RB1FQdoYupCuv2nXn0Y4Mvt D0/KJg0bENQTAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTEwLTEzVDA2OjE2OjI5KzAwOjAwUg3Z cQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0xMC0xM1QwNjoxNjoyOSswMDowMCNQYc0AAAAASUVO RK5CYII= X-Now-Playing: Rival Consoles's _Odyssey, Sonne_: "Recovery (Vessels Remix) -Bonus Track-" Received-SPF: pass client-ip=2a01:4f9:2b:f0f::2; envelope-from=larsi@gnus.org; helo=quimby.gnus.org X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, 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:297657 Archived-At: Yuan Fu writes: > From the suggestions I collected from the old thread, here is my proposal: > > We define a custom option treesit-settings (we can discuss the name > later), which controls whether to enable/disable tree-sitter for each > major mode, and the default preference, like this: > > (defcustom treesit-settings '((t nil nil)) > "Tree-sitter toggles for major modes. Hm... well, there's also modes that are "pure treesit", and there are (or will be) alternate modes with and without tree-sitter. I think users basically fall into two camps: The ones that want to have tree-sitter in all modes, and ones that want to enable it in specific modes (and ones that don't want it at all). (Note Computer Science-mandated off-by-one error.) This suggests to me that we should just use the normal minor mode machinery that we have for these things. That is, people that want treesit in python-mode will say: (add-hook 'python-mode 'treesit-mode) And people that want it everywhere will say: (global-treesit-mode) This mode will, in addition to switching `treesit-mode' on everywhere, also set up `major-mode-remap-alist', so that `typescript-mode' is mapped to `ts-mode', and `c-mode' is mapped to `treesit-c-mode' (which I'm sure somebody is going to write in a couple of days), etc.