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 introduction documentation Date: Sat, 31 Dec 2022 17:12:54 -0800 Message-ID: <08F4E03D-B834-452C-8941-2985E1B58B8B@gmail.com> References: <83edszjslp.fsf@gnu.org> <87tu1vxs3a.fsf@ledu-giraud.fr> <831qozjob7.fsf@gnu.org> <87cz8jxoat.fsf@ledu-giraud.fr> <83wn6ri7pn.fsf@gnu.org> <5e0a3185-de82-b339-0fa2-956779e63d6f@cornell.edu> <868rj6vfep.fsf@gmail.com> <4895891b-e5ea-9c37-f51b-df2e479ee758@yandex.ru> <83y1qt11xq.fsf@gnu.org> <9eb013da-d0fc-8e17-c6e3-1e8f913aebfa@yandex.ru> <83pmc50xxc.fsf@gnu.org> <71cfe4e8-3bb8-b0a6-9be5-8c0a6d92cfab@yandex.ru> <83h6xg29z3.fsf@gnu.org> <87wn6cyey5.fsf@posteo.net> <787B1EB4-1925-4679-8747-449DCD685432@gmail.com> <83y1qo6h7a.fsf@gnu.org> <83sfgw3oz8.fsf@gnu.org> <16C1E643-1CA0-417B-85EF-7053D4C27394@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) 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="12242"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Philip Kaludercic , Stefan Monnier , Dmitry Gutov , Tim Cross , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jan 01 02:13:29 2023 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 1pBmum-00031J-9C for ged-emacs-devel@m.gmane-mx.org; Sun, 01 Jan 2023 02:13:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pBmuP-0007Qy-H1; Sat, 31 Dec 2022 20:13:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pBmuN-0007QJ-Kx for emacs-devel@gnu.org; Sat, 31 Dec 2022 20:13:03 -0500 Original-Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pBmuJ-0001S7-1V; Sat, 31 Dec 2022 20:13:03 -0500 Original-Received: by mail-pj1-x102f.google.com with SMTP id 60-20020a17090a0fc200b002264ebad204so3444905pjz.1; Sat, 31 Dec 2022 17:12:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=YriJqLmvHwjSmbiueCxpwC1PesICR6fxYuXCzviLEu0=; b=ivx1fqxZqJx7BlG90yEPVI9kRSECWRFYNX24/Rm3/8U3tNnf7r+GeNYHH+lcNwLIBY hKPzUXOoh5pfIXBdWJDSpxNw59H4+SkfW0gBwT2Jq3j6cyoqhYe6uVrxV+QfxXFTqd8u xDwgCmCwFntL7qrCIRAIZLnmjMhUMhd0DujaPwKdr1WVlBJ4RQIiQOl2tBbuVkbgt46J Exc5GTlJLwFrEoihQ9Ik+OV5fnjZLv1y5I/s3cxnCuwEEEEiY6p7+IIRGKK+k5LHGV16 j0o2rT9+zTE3mnmLhSF1cWRc0pCgxwYMFS3GVzpB4qt2/hEcCuBNMWUxSVR60/nh3uZ3 ezRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YriJqLmvHwjSmbiueCxpwC1PesICR6fxYuXCzviLEu0=; b=MO4hSE8lJz8Z3lF9l1ZpJslDFK7W6aAeqPm/hk0tc9QyzmgDfm2naDMkFboR3jAu8D 7U2zjJZkAnuJm7Kgt8CQMksSMnqI3OF7jeIlFDSD2mqTMozBJ17ftGY2k3I2dpBz5j+H 4VlmBLI4baTAqrGbT9lMBaXrPZh7/4pY+Pq0oeOykceMLCIiMXLr4cSARbA98e7VMEyw 34PLM1lk0rm470a5a477GYjZf9ir9ajZbiTQ5Iox+1uziYUGOwOPQZxPZTlnHcf5w2aA r8m9L0pfGbcBeh0K+lYV4Nv8hmmNnz3Ohimou0nIpbMbGRuI9CoTX/ELJdtjS3ykP7Po MHvg== X-Gm-Message-State: AFqh2kpE/Huy+GOFsfOCjoKrnIHkFTY6wyif9GaWr2zULNXQ7DdCSQD+ 60ZcR+rDxQMEqRLqKhMlnh97/z0UsZXJzQ== X-Google-Smtp-Source: AMrXdXvdTZJLH+jRzXDze8INpe6EqKoFysvQO8zWZiSqbk8n75CqjBeCLM6BQXzP/BLMoO5/dlBS0Q== X-Received: by 2002:a17:902:d3cc:b0:192:9a4a:8400 with SMTP id w12-20020a170902d3cc00b001929a4a8400mr14012084plb.30.1672535576459; Sat, 31 Dec 2022 17:12:56 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id jb3-20020a170903258300b0018bde2250fcsm17399941plb.203.2022.12.31.17.12.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 31 Dec 2022 17:12:56 -0800 (PST) In-Reply-To: <16C1E643-1CA0-417B-85EF-7053D4C27394@gmail.com> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=casouri@gmail.com; helo=mail-pj1-x102f.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_REPLY=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:302166 Archived-At: > On Dec 31, 2022, at 2:14 PM, Yuan Fu wrote: >=20 >=20 >=20 >> On Dec 31, 2022, at 1:24 AM, Eli Zaretskii wrote: >>=20 >>> From: Yuan Fu >>> Date: Fri, 30 Dec 2022 16:03:42 -0800 >>> Cc: Philip Kaludercic , >>> monnier@iro.umontreal.ca, >>> dgutov@yandex.ru, >>> theophilusx@gmail.com, >>> emacs-devel@gnu.org >>>=20 >>>> I don't think treesit-language-source-alist is a good idea, = especially >>>> if we don't intend populating it, at least not as a user-facing >>>> feature. Instead, the command should ask the user for the relevant >>>> values, and offer recording the values on some file that would be = read >>>> next time the user wants to install an updated library. >>>=20 >>> I consider this as a fallback method for installing language = grammars. Because distress might not end up bundle language grammar for = us, and even if they do, they can=E2=80=99t cover every grammar so some = user would end up needing to install some grammar by themselves. If we = don=E2=80=99t include this feature, someone will definitely write = something like this and make it a third-party package (indeed, someone = already has). So we might have it in Emacs and do it right. >>>=20 >>> This is the use case that I had in mind when writing this function: = some major mode xxx-mode requires language grammar for xxx, so it has = the following instruction in its readme: >>>=20 >>> Add installation recipe of tree-sitter-xxx to your config, and run = treesit-install-language-grammar: >>>=20 >>> (add-to-list 'treesit-language-source-alist >>> '(xxx "https://github.com/xxx/tree-sitter-xxx.git")) >>=20 >> This is a user command, so it must comply to some minimal level of >> usefulness and user-friendliness. Right now, if you invoke the >> command after just loading treesit.el, you will be stuck at the first >> prompt, since Emacs says "No match" whatever language you try to type >> at the front. >>=20 >> Why not allow the user to specify all the necessary data needed for a >> language, if treesit-language-source-alist lacks those details for >> that language? You can then update the data structure with those >> details. Wouldn't this be much better and user-friendlier than = asking >> users to read the readme and fill a data structure (which some of = them >> could fill wrongly, not being Lisp programmers) in advance? >=20 > Makes sense, I can do that. Done. Free feel to adjust the wording, etc.