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: Tree-sitter api Date: Mon, 13 Sep 2021 11:01:47 -0700 Message-ID: <6A4CE984-6ACE-4E66-8EF2-F3D351C02248@gmail.com> 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> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) 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="347"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?utf-8?B?VHXhuqVuLUFuaCBOZ3V54buFbg==?= , Theodor Thornhill , =?utf-8?Q?Cl=C3=A9ment_Pit-Claudel?= , Emacs developers , Stefan Monnier , stephen_leake@stephe-leake.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Sep 13 20:03:17 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 1mPqIW-000ATL-Vl for ged-emacs-devel@m.gmane-mx.org; Mon, 13 Sep 2021 20:03:16 +0200 Original-Received: from localhost ([::1]:60590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPqIV-0006Rr-KI for ged-emacs-devel@m.gmane-mx.org; Mon, 13 Sep 2021 14:03:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36506) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPqHA-0005hf-Ba for emacs-devel@gnu.org; Mon, 13 Sep 2021 14:01:52 -0400 Original-Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]:35563) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPqH8-0001NP-I2; Mon, 13 Sep 2021 14:01:52 -0400 Original-Received: by mail-oi1-x230.google.com with SMTP id r26so15190418oij.2; Mon, 13 Sep 2021 11:01:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=BY5Ea1XdAY5bh+/TWHC7jQhMpSD0+bsM9wfcW0xFJCw=; b=AtbgxzkONe87tQXhXY2qeG2LMlDP+kEGIZ2K0vTpD8U3L9YyDG5nEhWgzHlOVgWkhd 2loF43TsiXssEt0JPsb5c/cezr2dGagYP0Dhmxcndp+n81R78jl0zroFP5DDvOY+Miiy 2MwEpAEklx2XAl7LwfgEHtdCW0IpaFIFoews8blAUEj66FHCZfnVsI7YLUuQ9cOiwxUd tn0Npg6cCCc/1PxNXCi8WAIpyHvIDCLWOCreUrqkB9hsWDOWJc1Rw0G2zmPh+pKRIBVz ssPZBnianUlOCaWu9GN3uKWxXS8ofvfg3WH+LjA1YnbU+XdTjKSzKTBy2QQ6gp9w0u53 T0yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=BY5Ea1XdAY5bh+/TWHC7jQhMpSD0+bsM9wfcW0xFJCw=; b=EkiP5B962ot22qnYjsqP1Hp0oeo96G5qztQrL8ECSVh4t+a/eOpcEPJZRL6EM4iX2R xza1gVezwsK5TFVkuhxGFjrxXlcxH92ot2xL9qAR4exR0NdaAwKFQaeOYnvIJRvNUXo2 Sg6WCaqOVYYCx7dd/dSOEi42LDiRkNWPbe4NrvSqfEQwuT0uWjFPUw+V37VjPYP6dY3h W6DIHkbtnQJ8rGCny6crMvIeqkgn++N32DkuCwMHtwzkUwaWK7dTcIB3a9n/Ci48OHiv Bnb1tyqvytSNKCOwzgzFrO5CLv6XhyCxMVwaRA7dN5SFi2nqPar0TCAjNW0xYhCdWnO8 8eOA== X-Gm-Message-State: AOAM533kDTthvntJbwimPQzXYRWXPqxU98HJPuvgIl8i/9OfJl1taOkz hPcIg61r05fVWVEltPX4Uglfhv77bVZ08Fp1 X-Google-Smtp-Source: ABdhPJw+dda9kNxIERK8VflacOJJ1VmYR9knVMHYI7dZMBct61zJhoTy/TOi2o8JuW8iPkB3WZA/NA== X-Received: by 2002:aca:918:: with SMTP id 24mr8700589oij.58.1631556108937; Mon, 13 Sep 2021 11:01:48 -0700 (PDT) Original-Received: from smtpclient.apple ([2600:1700:2ec7:8c9f:a1fa:bf8f:af60:ddef]) by smtp.gmail.com with ESMTPSA id a10sm1836541oil.30.2021.09.13.11.01.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Sep 2021 11:01:48 -0700 (PDT) In-Reply-To: <83r1dselyo.fsf@gnu.org> X-Mailer: Apple Mail (2.3654.120.0.1.13) Received-SPF: pass client-ip=2607:f8b0:4864:20::230; envelope-from=casouri@gmail.com; helo=mail-oi1-x230.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.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:274659 Archived-At: > On Sep 13, 2021, at 4:47 AM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Sun, 12 Sep 2021 21:15:31 -0700 >> Cc: Tu=E1=BA=A5n-Anh Nguy=E1=BB=85n , >> Theodor Thornhill , >> Cl=C3=A9ment Pit-Claudel , >> Emacs developers , >> Stefan Monnier , >> stephen_leake@stephe-leake.org >>=20 >> Not the end-user, no. But not really =E2=80=9CLisp Program=E2=80=9D, = either. I mean the human being writing the major-mode and adapting the = major-mode to utilize tree-sitter features. The major mode writer should = be able to figure out the correct symbol to use, if she go checks out = the project name for the language definition, or the package name of the = language definition in her package manager, or by some other means. For = example, one should be able to figure out that tree-sitter-c is the = symbol for C language definition, and tree-sitter-c-sharp that C#. Then = Emacs automatically translate tree-sitter-c to libtree-sitter-c.so, and = tree-sitter-c-sharp to libtree-sitter-c-sharp.so; basically adding = =E2=80=9Clib=E2=80=9D and =E2=80=9C.so=E2=80=9D (or =E2=80=9Cdylib=E2=80=9D= etc). If that doesn=E2=80=99t give the correct library name for a = quirky language, the major-mode writer can add an entry to = tree-sitter-library-name-override-list=E2=80=94(tree-sitter-quirky-lang = =E2=80=9Clibtree-sitter-qlang=E2=80=9D =E2=80=9Ctree_sitter_qlang=E2=80=9D= )=E2=80=94and Emacs will use that. (Or she can just use = tree-sitter-qlang as the symbol, and Emacs=E2=80=99 auto translation = would just fine.) >=20 > It makes little sense to me to request each major mode to figure this > out. It should IMO be a service provided by the TS integration into > Emacs. This is IMO the easiest and least confusing way for major-mode authors. = But before we continue, what is the way you envisioned? I=E2=80=99m not = sure what exactly is the service you want Emacs to provide. Yuan=