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 maturity Date: Sun, 29 Dec 2024 00:59:50 -0800 Message-ID: <5D1AB17D-8847-42ED-B246-8DB4D11F7FB7@gmail.com> References: <1ed88fca-788a-fe9f-b6c8-edb2f49751c9@mavit.org.uk> <67428b3d.c80a0220.2f3036.adbdSMTPIN_ADDED_BROKEN@mx.google.com> <86ldwdm7xg.fsf@gnu.org> <6765355b.c80a0220.1a6b24.3117SMTPIN_ADDED_BROKEN@mx.google.com> <00554790-CACA-4233-8846-9E091CF1F7AA@gmail.com> <86msgl2red.fsf@gnu.org> <87o710sr7y.fsf@debian-hx90.lan> <8734i9tmze.fsf@posteo.net> <86plldwb7w.fsf@gnu.org> <87ttapryxr.fsf@posteo.net> <0883EB00-3BB2-4BC8-95D1-45F4497C0526@dancol.org> <87plldrx6a.fsf@posteo.net> <87ikr5rwx0.fsf@posteo.net> <86ed1rq6gc.fsf@gnu.org> <73737665-984E-4C97-9183-7805C1BCB550@dancol.org> <86bjwuricz.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) 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="4529"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Daniel Colascione , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Dec 29 10:00:36 2024 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 1tRpA2-00011K-VP for ged-emacs-devel@m.gmane-mx.org; Sun, 29 Dec 2024 10:00:35 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRp9g-0007be-4N; Sun, 29 Dec 2024 04:00:12 -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 1tRp9c-0007ax-Bd for emacs-devel@gnu.org; Sun, 29 Dec 2024 04:00:08 -0500 Original-Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tRp9Z-0003K2-PF; Sun, 29 Dec 2024 04:00:07 -0500 Original-Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-2ee786b3277so7906210a91.1; Sun, 29 Dec 2024 01:00:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735462803; x=1736067603; darn=gnu.org; 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=AOcuvFoLhhWHYGcD/RSJrYDrkLN8IoVtCCkHpLAbonc=; b=GO4JljqHwUu6UMZXmzkvow0YZVv0WCLeDSC2n9CM7ZZ+0oLTKm1FEQMz2JxJbvxvfv HqJvGyfbRFfzz3VChWPUZfYv4OIPteIuxPaCtPhh49v4VG4g2ZCszZ1bJBnLvwAI9Rsd DtryJIKLMt6U0IsT2dWaNQF16Vhxfmo4XA7vrTbkvEk+DHkc2bezX4hXH0rTGbL2jJm8 YVWLkhvn6dBlX9kv6Q1DfzLKFIFWeftKDrdcyLk77Z0OiEInWqdHGx09A/r9yPkG0ctQ 5yXvSkkEbYCQXF7t298hTmxC3AR9WZmOCXQdYPSM95kwyMlDqQfdrHnEqsgwmqz0F9Sk Xq5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735462803; x=1736067603; 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=AOcuvFoLhhWHYGcD/RSJrYDrkLN8IoVtCCkHpLAbonc=; b=vk6ceQMT4d6C5ZZrvjGKmTDaigABbEh2MH20hAI6cMBRvjt4Y+H7cundbuM172F/HU /WzLySXwWxl7w8QBje4WUPz/RZfE+pCQ7ye0cP8vZpLJzrJkrWK9ms4iPIUXAL+wnrQW F2rxxGVZimQl0+NMYZFHqnylFfRMLwKpywkDkJ3nuMvIEPOQhBm4vCrh12uNWrHkvDG+ 6m7QZz3N9DbCfWpaNgj4KsZ8n4W7ZrBhnIf0IsvMri0zg6NzuKXrYs7Hchvc5zigbr2w KWgmyzYaOkdK0/a+DWm5pvj0ex7EmaFPtLCzYEmPZXSQSiQ2WgIUYeF/byAgZBYrCQu2 hqtg== X-Forwarded-Encrypted: i=1; AJvYcCWBeB76yT766C+33ouTS05fQQtRZ7vj/vEbLk9vJTIy5ufpvQOAQDPJZ4RvHsl3zE/Cf/Kyoh4kA80Iaw==@gnu.org X-Gm-Message-State: AOJu0YycEl0XZiyao9zHTx1YBUYHDZIJTUmBWayiH7GjM7tbnN2xX55x 8Udp8+yY7sfj0D8atghDBh15ldRS7kKy6rln3joWN/E/G043SsSup4U0uQ== X-Gm-Gg: ASbGncvBSo43n5G0XntZB11t0nr2Ut6PmEW7oZJu7dyeKHGplZV0q78KtDARSaOV/vq IH49OaZFQiThHC+t3YjN254sV8i1L9IyO9ltznHcKX0QkcebCGR2tPKWDPJCDoBQHxec7jioiAg CzchcnY8SiuIAqzoMQlau9p1GRzCmMqdhhSS5humY9gpluEVTxBjGzhjl9jSHNAgs/OOTtpTv4i O+FzUxJ8EhxQKHpsoDYeQO0tXX+yMJjsix0HNnG306U3MOFIg7Nc+ZRyDp+Oy6X0IzzYtTcBUdT fT+b X-Google-Smtp-Source: AGHT+IFWiDLsdlpUXSzez5EiF3RkbxDDy54Y3bPAdIk2hOdfmRGHiWlTOBkXq3l3KjNBZFsGl0M5Ow== X-Received: by 2002:a05:6a00:398c:b0:726:41e:b313 with SMTP id d2e1a72fcca58-72abdeaabdemr42207941b3a.16.1735462802547; Sun, 29 Dec 2024 01:00:02 -0800 (PST) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:f1c9:d034:5332:4d9a]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad83475asm17211302b3a.57.2024.12.29.01.00.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Dec 2024 01:00:01 -0800 (PST) In-Reply-To: <86bjwuricz.fsf@gnu.org> X-Mailer: Apple Mail (2.3776.700.51) Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=casouri@gmail.com; helo=mail-pj1-x1032.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.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:327324 Archived-At: > On Dec 29, 2024, at 12:41=E2=80=AFAM, Eli Zaretskii = wrote: >=20 >> Date: Sun, 29 Dec 2024 03:01:44 -0500 >> From: Daniel Colascione >>=20 >>>> Enforcing this policy will just mean that Emacs doesn't support *at = all* some languages out of the box and will put even more wind in the = sails of soft forks like Doom. Tree sitter language descriptions are = free software. There's no reason not to rely on them. >>>=20 >>> We started with this concept of adding tree-sitter based modes to >>> auto-mode-alist by default, but found that people who don't have the >>> grammar installed didn't appreciate seeing the warnings about the >>> missing grammars. So Emacs 29 made these modes optional, activated >>> only by an explicit user action. Emacs 30 still does that. >>>=20 >>> We are currently discussing how to improve this (see the thread Re: >>> Turning on/off tree-sitter modes, which seems to have stalled = lately). >>> But until the grammar libraries are ubiquitous, and we can rely on >>> them being present on most systems, I think we will still need some >>> user say-so before enabling tree-sitter based modes. >>=20 >> Wouldn't vendoring the grammars, and maybe even tree sitter itself, = silence the complaints about the warnings? Tree sitter is pure = algorithmic code. It doesn't have any particular platform dependencies. = Why not simplify the whole system and make it a mandatory (and = optionally bundled) dependency so that the show cognitive load of having = to consider non-TS environments is just deleted? >=20 > First, the tree-sitter library itself is optional, so Emacs could be > built without it. Or are you suggesting to import the library as well > into Emacs? If we don't import the library, making it a mandatory > dependency is not TRT, IMO, because some users don't need the modes > supported by tree-sitter, so forcing them to install the library that > is not really useful to them is not right. We never do anything like > that with any other external libraries. GMP is special, but even for > it we added our own "mini-gmp". >=20 > Next, importing the grammar libraries into Emacs is not a simple > matter, either. Their sources are in JavaScript, so if we want to let > users produce modified grammars (as we do with everything we have in > the release tarballs), they will need to have Node.js etc. installed, > which will become a prerequisite. And there are other complications, > like the need to sync regularly with their upstream repositories. > Moreover, there's no precedent for doing this, if you exclude lwlib > and oldXMenu (which are different, since they are not developed > outside Emacs). >=20 > So I, for one, am not very happy to add this to our maintenance > burden. It might make things easier for some (but see below), but it > doesn't come for free. >=20 > I also don't understand the fuss, really. Compiling a grammar library > after cloning the repository takes seconds, so why do we have to do > all this on behalf of the users if the users can do it so easily, even > if distros don't? E.g., I have on my system almost 70 grammar > libraries, which I regularly update and build with a small number of > simple Makefiles -- how hard can that be for anyone who is interested > in these modes? Why does it have to be _our_ responsibility, any more > than, say, Grep or Findutils -- which are also heavily used by Emacs? > Or even the image libraries? Why shouldn't this be the job of the > distros? The upstream project doesn't have to think about packaging, > it's the job of the distros. Also, distros are picking up on packaging tree-sitter grammars, so I=E2=80= =99m hopeful of a future where Emacs is packaged with tree-sitter = grammars for the builtin major modes. And AFAIK packagers very much = dislike editors bundling tree-sitter library and grammars themselves. Bundling grammars has another complication which is tree-sitter = library-grammar compatibility. If we were to bundle grammars, we must = also bundle tree-sitter library, lest we risk to encounter a tree-sitter = library provided by the system that=E2=80=99s incompatible with the = bundled grammars. And bundling the tree-sitter library is obviously = undesirable. Yuan=