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: Fri, 14 Oct 2022 13:02:17 +0200 Message-ID: <87v8ombrd2.fsf@gnus.org> References: <3A7E7CD1-74A7-4352-9DFE-FC982EAA398E@gmail.com> <87ilko9r9e.fsf@gnus.org> <9794E2EF-4DB5-4A04-90F0-3EB51E6BE008@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="39244"; 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 Fri Oct 14 13:06:49 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 1ojIWe-000A1X-UQ for ged-emacs-devel@m.gmane-mx.org; Fri, 14 Oct 2022 13:06:48 +0200 Original-Received: from localhost ([::1]:60242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ojIWd-0007GL-AT for ged-emacs-devel@m.gmane-mx.org; Fri, 14 Oct 2022 07:06:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ojISP-0005fQ-U8 for emacs-devel@gnu.org; Fri, 14 Oct 2022 07:02:25 -0400 Original-Received: from quimby.gnus.org ([2a01:4f9:2b:f0f::2]:34750) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ojISO-0004pc-GM for emacs-devel@gnu.org; Fri, 14 Oct 2022 07:02:25 -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=7SBcKGlLCiwpyTBABNwS+5c7+u/YMsoUg6w9JgARrpI=; b=cxrpwmGx2Urenvt/k1Zpyyc/By rTz8jFReZL1JAfRx4PaaoPM/gDVkoCOC9Ygboni06bY8m4MDTFiEw/3AEgaHoo267F9Jlq8+hsvZh ql/P1kKLEZ429RxhA7aetNnyzT/x5kBMBFFrCPwphYAjQbALAxV1gJ0Lg0Fdf1lBxlx0=; 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 1ojISJ-0005Fz-QL; Fri, 14 Oct 2022 13:02:21 +0200 In-Reply-To: <9794E2EF-4DB5-4A04-90F0-3EB51E6BE008@gmail.com> (Yuan Fu's message of "Thu, 13 Oct 2022 12:44:01 -0700") Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAElBMVEUtOohUX543RI8d K4Jpcaf///89eE6PAAAAAWJLR0QF+G/pxwAAAAd0SU1FB+YKDgo2LWfydXsAAAF9SURBVDjLlZSN ccMgDIUF7gBIYQBBOkDqLhB83n+mPvET4ybpXe27CFvofTyBQ+SyCyo5eRey4E7ZBguRUxdIyBIe M7xThLAQZqQ2sQbuAyWOXK8eig0KbkjhMXFgSiIYJTwKB2PEDy73zSZuG3/yzrHskEIictx4l4IL L2NP5C4VQ2ck+5ng/TU3OBtcvapooqRYpWSXPQzSSOREEWQ2Q5bQljDnxOWz7FtzbvC/nZcReHJO kAqQahpdqsJdXRXeQIG9wbXBRyJvYhWvEgEVri/3gEcu5dT2WgH4qgFb6c8GsSqPmSXIw2CtqHu+ 72XviVYxfKx6uWCGJRBObS9z2+0cjV7J0as8tyTfzy2hDkdLhkFtFetoIoUZ/uaiaYckTeHXfkxS zXmo8GmjZviXhfwPeAIV59wOrLSTSOvVpG5rl6IBp1dwmuD+7PzNSczPqzo+g8XgC+DX1/DnljTL T21/U+HP8HL8E1SpSr0NqQNeEwejJ75HRVvDI/ED2wdVdiJRlzIAAAAldEVYdGRhdGU6Y3JlYXRl ADIwMjItMTAtMTRUMTA6NTQ6NDUrMDA6MDAn/d/jAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIyLTEw LTE0VDEwOjU0OjQ1KzAwOjAwVqBnXwAAAABJRU5ErkJggg== X-Now-Playing: Xeno & Oaklander's _Par Avion_: "Par Avion" 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:297715 Archived-At: Yuan Fu writes: > Ok, so to make it concrete, in addition to treesit-mode and > global-treesit-mode, we would have > > treesit-major-mode-remap-alist: same as major-mode-remap-alist, > appended to major-mode-remap-alist when global-treesit-mode turns on. Yup. > treesit-toggle-function: A function treesit-mode calls to enable > tree-sitter support, major modes set this function. Hm... I'm not sure. A mode like python-mode which has both treesit and non-treesit code paths would just be (if treesit-mode (do-one-thing) (do-the-old-thing)) I think? On the other hand, that wouldn't allow dynamic switching between treesit and non, so perhaps we should have something like that; yes. > I have yet to come up a way to combine the minor-mode machinery with > the ability to specify backend for each feature (imenu, xref, > font-lock, etc). > > Maybe we can have something like > > feature-provider-alist: An buffer-local alist of (FEATURE . > PROVIDERS), FEATURE could be indent, font-lock, imenu, xref, etc, > PROVIDERS is a list of treesit, eglot, emacs, etc. > > But I failed to see how to integrate it with the rest. > > I wonder if we can have a major mode hook that runs before the body > runs, like xxx-mode-before-hook. Then user can set > feature-provider-alist in that hook. This way major modes can decide > what backend (provider) to use for each features. Hm...