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 api Date: Wed, 15 Sep 2021 09:15:00 +0300 Message-ID: <83zgsebc0r.fsf@gnu.org> References: <83r1f7hydn.fsf@gnu.org> <95F37923-5BF9-4D81-B361-267CF119FBCA@gmail.com> <735AF34C-FD18-4A6A-A99D-E5D8EB4DE4F3@gmail.com> <40611F1F-7B5C-4885-A2CA-CE709ED8D22B@gmail.com> <4E876354-10D1-46B3-8124-CAE916261F08@gmail.com> <0A3F5464-B90D-4D47-BBDD-CCA26D877F43@gmail.com> <83tuiys1y4.fsf@gnu.org> <835yvcpdip.fsf@gnu.org> <7B1F90DE-A992-4F51-B391-0A4E5A598780@gmail.com> <3E8CA8E4-E623-4051-A76D-508C6CF94B6A@gmail.com> <837dfpj5yf.fsf@gnu.org> <8335qbirsr.fsf@gnu.org> <73E0B1F6-6F9F-40E0-927E-D08481BFF391@gmail.com> <834kaqhqlp.fsf@gnu.org> <8335qahqgk.fsf@gnu.org> <3BC29D06-CA75-4706-9AD7-ABA2F65C4DEE@gmail.com> <83v936fj35.fsf@gnu.org> <83r1dselyo.fsf@gnu.org> <6A4CE984-6ACE-4E66-8EF2-F3D351C02248@gmail.com> <83r1dscpt2.fsf@gnu.org> <83o88wcof9.fsf@gnu.org> <83lf3zdh4z.fsf@gnu.org> <8965C4A0-79D3-4D77-A6BA-D07A6C93F7FE@gmail.com> <83ilz3cs4k.fsf@gnu.org> <04D19C1A-CD64-4156-B932-1C9FEEE4EC7B@gmail.com> 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="31848"; mail-complaints-to="usenet@ciao.gmane.io" Cc: ubolonton@gmail.com, theo@thornhill.no, cpitclaudel@gmail.com, emacs-devel@gnu.org, monnier@iro.umontreal.ca, stephen_leake@stephe-leake.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 15 08:17:01 2021 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 1mQOE9-000814-2I for ged-emacs-devel@m.gmane-mx.org; Wed, 15 Sep 2021 08:17:01 +0200 Original-Received: from localhost ([::1]:53656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQOE7-00009G-4G for ged-emacs-devel@m.gmane-mx.org; Wed, 15 Sep 2021 02:16:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQOCp-0007JG-DC for emacs-devel@gnu.org; Wed, 15 Sep 2021 02:15:39 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:54078) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQOCn-0004Ix-6e; Wed, 15 Sep 2021 02:15:37 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1976 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 1mQOCH-00084l-H8; Wed, 15 Sep 2021 02:15:25 -0400 In-Reply-To: <04D19C1A-CD64-4156-B932-1C9FEEE4EC7B@gmail.com> (message from Yuan Fu on Tue, 14 Sep 2021 17:50:48 -0700) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:274727 Archived-At: > From: Yuan Fu > Date: Tue, 14 Sep 2021 17:50:48 -0700 > Cc: Tuấn-Anh Nguyễn , > Theodor Thornhill , > Clément Pit-Claudel , > Emacs developers , > Stefan Monnier , > stephen_leake@stephe-leake.org > > > Almost: there's the (minor) problem of obtaining the "" part by > > the major-mode. I think it would be good to have a utility function > > to do that so that major modes won't need to reinvent the wheel, do > > the research, etc. > > That’s where I don’t understand: the major mode is written by major mode writers, who certainly know the correct “” name: they need to read the source of the language definition to use language’s tree-sitter features. You seem to agree on that because you said that this function can be extended by major mode writers. I don't understand what you are saying here. Why would major mode programmers need to know the correct name? The TS facilities we will have in Emacs will be language-agnostic, right? For example, to correctly indent a line of code, the major mode will call some hypothetical tree-sitter-get-indentation function, and that function will work in any major mode, provided that the major mode told TS to load the support for the programming language of the buffer. Right? So when the major mode initializes for working with TS, it should tell TS which language to load, and why would we request the major mode programmer to know the correct name which corresponds to the major mode's programming language? Why would they need to "read the source of the language definition to use language’s tree-sitter features"? The specifics of the TS implementation of, say, indentation calculations won't be exposed on the level of the indentation facilities provided by TS integration in Emacs, right? There's some misunderstanding here, and I cannot for the life of me figure out where is it. > But if you mean an ordinary end user need to know the correct name No, that's not the issue I'm talking about.