From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter integration on feature/tree-sitter Date: Sat, 07 May 2022 22:25:42 +0300 Message-ID: <834k21xhzd.fsf@gnu.org> References: <9E6D13F6-7E50-44EE-A357-C971A11A3636@gmail.com> <837d6xzpac.fsf@gnu.org> <7B1F29B4-045A-420E-8FD7-C7C72FF14DDC@gmail.com> <837d6xxjpv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20950"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat May 07 21:27:00 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 1nnQ4x-0005Jz-UH for ged-emacs-devel@m.gmane-mx.org; Sat, 07 May 2022 21:27:00 +0200 Original-Received: from localhost ([::1]:51012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnQ4w-0006eL-HG for ged-emacs-devel@m.gmane-mx.org; Sat, 07 May 2022 15:26:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56852) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnQ3s-0005Dh-93 for emacs-devel@gnu.org; Sat, 07 May 2022 15:25:52 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:43026) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnQ3q-00045l-DR; Sat, 07 May 2022 15:25:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=OpF6VFuG7hyAlRRp9U2XI94IrCmkIsnqihDkBe4D+II=; b=S0MRycb5kMuoCOHCKdE7 RP0xzAJHG2AB0YrEQdwZykGaL2HpupN1eLr2iSODs9F5C4o/mTaXbzfO9H/kQQeSlg4B7zyhkYC43 OsMfC+vfzSNc3/O7+Zszzbkh7QqLP77uAKxWqHhKHyr8yWMjRXcgNwDUwObGeMgVuctylpPK3G0Qq VOtjm3RgY8sG1uYe4ACHhUyXf+qYIJ3DsCm2ck3N4C/338L7uyYMOmQbaeojsGVurJU+LeRoarszj A+eLn6HTYyX+hqHGJvk5WMOMVRamJLHSR37EfhbdnIBcl/O4tiQr4T1zoVas53/c+SYmm6PwsOqz1 08Unegp4ZYbWig==; Original-Received: from [87.69.77.57] (port=2584 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnQ3p-0005Jz-TN; Sat, 07 May 2022 15:25:50 -0400 In-Reply-To: (message from Yuan Fu on Sat, 7 May 2022 12:11:06 -0700) 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:289430 Archived-At: > From: Yuan Fu > Date: Sat, 7 May 2022 12:11:06 -0700 > Cc: emacs-devel@gnu.org > > > However, I hoped that the font-lock and indentation are already > > integrated with tree-sitter, and all that is needed for a given > > major-mode to use it is to flip some variable. I didn't expect to > > need a completely separate major mode for C sources, for example. > > > > It sounds like we are farther from the goal that I thought we were, > > and some serious work is still ahead of us to get this integrated into > > the existing major modes. > > I used a separate major mode because I don’t want to touch the existing one, and this is only a simple demo. For the author of a major-mode, they only need to port their font-lock-defaults and indent function to use tree-sitter features. If you look at the definition of ts-c-mode, its roughly But eventually, we will touch the major modes, because the goal, AFAIU, is to have tree-sitter-supported features be part of the major modes Emacs provides,l perhaps first as an opt-in feature, but eventually I hope as the default behavior. > > However, I hoped that the font-lock and indentation are already > > integrated with tree-sitter, and all that is needed for a given > > major-mode to use it is to flip some variable. > > That’s too much magic to ask from tree-sitter. I didn't expect tree-sitter to do this for us, I thought the code which integrates it into Emacs should do it, and hoped that code was already written. Don't be mistaken: that I thought the situation was different is entirely my fault, not yours. Thank you for the work you have done that brought us where we are today.