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 14:14:00 -0800 Message-ID: <16C1E643-1CA0-417B-85EF-7053D4C27394@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> 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="5467"; 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 Sat Dec 31 23:14:47 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 1pBk7r-0001DB-DV for ged-emacs-devel@m.gmane-mx.org; Sat, 31 Dec 2022 23:14:47 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pBk7C-0008IY-UT; Sat, 31 Dec 2022 17:14:06 -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 1pBk7B-0008I7-Fm for emacs-devel@gnu.org; Sat, 31 Dec 2022 17:14:05 -0500 Original-Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pBk79-0001pK-R6; Sat, 31 Dec 2022 17:14:05 -0500 Original-Received: by mail-pj1-x1029.google.com with SMTP id n12so13113025pjp.1; Sat, 31 Dec 2022 14:14:03 -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=aV3ey0WggZvPjs8wo29pUMuVwpX6+nsMgbp3GGzVW7A=; b=VnijtqnJYDj6F2j/FDJ6rWJmUc0d4U0ChCOjv8S+8AUC5WPqy9bVLTuMZezjSUCGTg bpB4D70pmLiyVDiL3ytBFOwtyqFYjahQie1OgmUAY2t9sMKWh5xWjc2yRp8Wr2KWy0IK n6P0/J76SuKLTseN7zdVxSs2D1odvvBcjCaubQo80vto26ldz3prmGfdJFxwyLXWoMCs k3griPphCm9RqFpZ/EeZ6Oty2ZaBgr3bWQNyZMMi/kPE0jTaaoG3ptK2bD4rjbvXlf+X eJkprOcytA3agffbF/BBW0eZXeyjd53/0eHx8JMSfnbwW6GZwkkn7+AyhohmgiKWj1yW wtEw== 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=aV3ey0WggZvPjs8wo29pUMuVwpX6+nsMgbp3GGzVW7A=; b=Cl7DYC8lstxYDcT3ndxZ4x4iUUaNJbF1wBxH+3IDnSUko06pUx6PiyVkV/DPLhaHYN K0/A0vc2W6x0qN1Vy7VoI57HY73iqknXSZU5R/BMHnjbcmB7niOKfHBt8tk1wwUVtPBj 4W3cPSSOgepHzCxMm5CgwybuGignlQiEZ3EaaAzTpXIfEKHL91i5limhgSRy4lPDPHiP hSmaQzMvXXphirnv36UJPaxA5JW8BlaaDbBa6KBMTH+GO9FGBgNo7AKzCbuPkjvbtZN1 BjDtUyFPZCdkL4QpvqI/SgsKG1MNt7V8YueK2KhdJ7EQ2jp6B/vbuTZmBMp815n69Cjj LL7w== X-Gm-Message-State: AFqh2kowtimWJaEQ+C4GPf1XEwgcUzk1kvtG2ILtHkxa22piKPXFXbp8 OqTYNWYUaz5xwN0qchpJz/R61nRa3nE= X-Google-Smtp-Source: AMrXdXvyDZX+EMZtyC9myVWvQdetVYw7ap9BA+H6+jTpC/bDSI6LvsV5xuhYF3SpiHZYOI2NIuv6sQ== X-Received: by 2002:a17:902:d192:b0:192:77df:45d9 with SMTP id m18-20020a170902d19200b0019277df45d9mr21234650plb.17.1672524842007; Sat, 31 Dec 2022 14:14:02 -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 n20-20020a170902d0d400b00186c3afb49esm1973819pln.209.2022.12.31.14.14.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 31 Dec 2022 14:14:01 -0800 (PST) In-Reply-To: <83sfgw3oz8.fsf@gnu.org> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=casouri@gmail.com; helo=mail-pj1-x1029.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:302160 Archived-At: > 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? Makes sense, I can do that. >=20 >>> This command should also be mentioned in NEWS, where we describe how >>> to install the grammar libraries. >>=20 >> I=E2=80=99ll do that if we decide this function is desirable and = good. >=20 > ?? It's already on the branch, so I think we are past that point? I thought that was my unilateral action which might be rejected, but = anyway, I=E2=80=99ll add a NEWS entry :-) Yuan