From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter introduction documentation Date: Tue, 27 Dec 2022 14:43:06 +0200 Message-ID: <9eb013da-d0fc-8e17-c6e3-1e8f913aebfa@yandex.ru> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6269"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Cc: monnier@iro.umontreal.ca, theophilusx@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 27 13:44:09 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 1pA9JQ-0001NZ-C7 for ged-emacs-devel@m.gmane-mx.org; Tue, 27 Dec 2022 13:44:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pA9Ia-0001ts-Ra; Tue, 27 Dec 2022 07:43:16 -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 1pA9IY-0001tV-LI for emacs-devel@gnu.org; Tue, 27 Dec 2022 07:43:14 -0500 Original-Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pA9IV-0000xH-7t; Tue, 27 Dec 2022 07:43:13 -0500 Original-Received: by mail-wm1-x32a.google.com with SMTP id m3so346342wmq.0; Tue, 27 Dec 2022 04:43:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=/Cd/Anm+/KZuoksynPchpmeW+KeqlItLzkxQuIb12FU=; b=cQTZpFxS7ZPMZpd0LW4o8uqKQmNX+Di/SZc1R9OKLs7Yps9hWkRdyzT2fw9jcQ2fRQ EyNefuMHh5kl+GWtD+CR9L6vDiVDrDzzgi+zJ1TcgRTTYv/A9VzvJCaiL8jbgEsYb6ou JnOQDku8phkDD5s+nEuMVGGl95IIkyBc6dYBZx6ChPoyllZP1ZJQV5RQUwKpkWwB8eoj Vmf8RRbtSdn2rdwwRawlLC9g2mrvlPwcPHXU3v197/dH3Ueys9BGfveLJYdW7htzcU1m ipXFAlCyldQEIT0n94jmEp22ZkmXCU7qOiNHACBJ5FheZlpMhfurUpBZ6Pe0XnJBGbXx X2Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/Cd/Anm+/KZuoksynPchpmeW+KeqlItLzkxQuIb12FU=; b=LsQUW5XBVy7mD2A1LfPd0C7ueKPhQTIX9Shescxi0K4MSUwV33gOzkhmOgc3yDrmEP 2t9fzbEACZWVcYdjxVqDdBzkv3m9mmBwSCmxiELbddq2lupImDPA2uMiEtzY3LLByJQ2 4kpjxsKF2lPH8LE+xhExTAPtO/NSlQri9tFf+aV903kFzrRXQNuVnzbIx2W3vBPa9hXZ 5Yw4B46H6S+OBSA9FxiFw1YEzT7xJKehYX5I2yRxUJ7pdetcfrq/upy/Z0eCIK8NXUhy lYxTmWWsTMZxLLHyiNnZbOSeU+5Yi88j4MlCtxY2YkR2UcC3EV9vlxXv4ZpwlGEVeq+W 9GSA== X-Gm-Message-State: AFqh2kpVEbPWbEfRRsoavecpQkYljrTMuORFxP1sQA12ojhGnHeLqZkC 04tkl/eMMbS2tbw83yuanDHptudf0is= X-Google-Smtp-Source: AMrXdXuISXjnq9R6gb3hIQZeeshAo0qE2cLKAuykzfYnZMRLbmSdHb4slkw4JJ3VNEa4y2+nij6yaQ== X-Received: by 2002:a05:600c:3b93:b0:3d3:43ae:4d10 with SMTP id n19-20020a05600c3b9300b003d343ae4d10mr15952064wms.11.1672144989285; Tue, 27 Dec 2022 04:43:09 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id m4-20020a05600c3b0400b003c6b7f5567csm36760759wms.0.2022.12.27.04.43.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 27 Dec 2022 04:43:08 -0800 (PST) Content-Language: en-US In-Reply-To: <83y1qt11xq.fsf@gnu.org> Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=raaahh@gmail.com; helo=mail-wm1-x32a.google.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-1.147, 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.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:301956 Archived-At: On 27/12/2022 14:11, Eli Zaretskii wrote: >> Date: Tue, 27 Dec 2022 00:42:55 +0200 >> Cc: emacs-devel@gnu.org >> From: Dmitry Gutov >> >> On 17/12/2022 17:42, Stefan Monnier wrote: >>> Those grammars have been in use for a while now >>> (by other editors), AFAIK, so why would the situation change just because >>> Emacs starts to use them as well? >> >> I guess "other editors" that use tree-sitter do bundle the grammars? >> >> Or include them in the optional language packages. Or provide built-in >> recipes to install them. > > WDYT about what we have in NEWS about this? Those instructions seem to be written foremost with distro maintainers in mind. Definitely better to have them than not, but I'd hate to present them to the average user. Do we expect all (most?) distros to compile all the popular grammars? That would still leave out the users of the less popular languages whose grammars were not included. Or grammars which saw updates since the distro-distributed version (so it's useful to install the newer version). >> E.g. nvim-treesitter seems to be doing the latter: >> https://github.com/nvim-treesitter/nvim-treesitter#language-parsers >> >> The corresponding recipes look like: >> >> list.ruby = { >> install_info = { >> url = "https://github.com/tree-sitter/tree-sitter-ruby", >> files = { "src/parser.c", "src/scanner.cc" }, >> }, >> maintainers = { "@TravonteD" }, >> } > > It sounds like a non-trivial maintenance burden to keep this kind of > DB up-to-date. So I'm not sure we should do this in the upstream > project. > > But if Someone(TM) wants to provide Emacs commands to download, > compile, and install a grammar library, I see no reason not to add > that to Emacs. This could be part of treesit.el, for example. I wouldn't worry too much about the maintenance burden (keeping the list of urls up-to-date?), especially since we could refer to such lists by other projects. I think ELPA is a better place for this feature, though. Because we always want the user to get the latest version of the recipes. Or if we put this into treesit.el, it would be better to keep the set of recipes as a separate package, so the updates to it can be put into ELPA (as a :core package). > One condition, though: please implement the commands in Emacs Lisp, > without invoking any shell scripting features (which shouldn't be > needed to begin with), just by using compiler, Emacs commands and > functions that deal with files, and (possibly) Git. > > Also, if we provide some list of grammar libraries we support > officially and their respective sites, that list should include only > libraries with a Free license. Makes sense.