From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id sL27Juz7gGIQGwEAbAwnHQ (envelope-from ) for ; Sun, 15 May 2022 15:11:08 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 0JyPJuz7gGKMBgEAauVa8A (envelope-from ) for ; Sun, 15 May 2022 15:11:08 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1FC02226CA for ; Sun, 15 May 2022 15:11:08 +0200 (CEST) Received: from localhost ([::1]:34570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqE1a-0006HX-NN for larch@yhetil.org; Sun, 15 May 2022 09:11:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqE1W-0006H9-6M for guix-patches@gnu.org; Sun, 15 May 2022 09:11:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:54865) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nqE1V-0005NH-U3 for guix-patches@gnu.org; Sun, 15 May 2022 09:11:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nqE1V-00021H-MH for guix-patches@gnu.org; Sun, 15 May 2022 09:11:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [PATCH v5 27/27] gnu: Add emacs-tree-sitter-langs. Resent-From: Pierre Langlois Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 15 May 2022 13:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49946 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxime Devos Cc: Pierre Langlois , 49946@debbugs.gnu.org Received: via spool by 49946-submit@debbugs.gnu.org id=B49946.16526202367718 (code B ref 49946); Sun, 15 May 2022 13:11:01 +0000 Received: (at 49946) by debbugs.gnu.org; 15 May 2022 13:10:36 +0000 Received: from localhost ([127.0.0.1]:48762 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqE16-00020Q-9y for submit@debbugs.gnu.org; Sun, 15 May 2022 09:10:36 -0400 Received: from mout.gmx.net ([212.227.17.20]:58023) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqE14-00020B-5L for 49946@debbugs.gnu.org; Sun, 15 May 2022 09:10:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1652620227; bh=B0Y4DSELNuHC5ocT64+KrCKinq/bMnNrb4ecpo1bFBo=; h=X-UI-Sender-Class:References:From:To:Cc:Subject:Date:In-reply-to; b=ZxrQBzyJn+hYTVF8Y607ga4EEHoTxQ237x2kT6mo6a85ksGOJhUpx3qamjQE5pE4B F2wlpiuv19FirexVe8sNu9cP/d9vFCRFFX31Ivcyx6E4JJh7vZ2HF0criTvIxi4A94 NO5I/AfrU4KCGAW9ayLEbHYxjd4l5hhm7qTIdCzY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from labiere ([82.69.64.142]) by mail.gmx.net (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MkHQX-1nS7Tu2IUj-00keC7; Sun, 15 May 2022 15:10:27 +0200 References: <877d9s2qa9.fsf@gmx.com> <20220329194318.6106-1-pierre.langlois@gmx.com> <20220329194318.6106-28-pierre.langlois@gmx.com> <0fa9d98cb9038a24e8596858a8d37d63071937a2.camel@telenet.be> User-agent: mu4e 1.6.10; emacs 28.1 From: Pierre Langlois Date: Sun, 15 May 2022 13:20:48 +0100 In-reply-to: <0fa9d98cb9038a24e8596858a8d37d63071937a2.camel@telenet.be> Message-ID: <87bkvz54cg.fsf@gmx.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Provags-ID: V03:K1:BpoOQTGXsAkVZd6dUuGnI2V6jdwAUAuIONhiRgwSsOBoXvLWge0 1zT3XzrO2SpXOTgFfPnbMBO230Rhm6OITt4KZnJ35QuSbvV4TMqRjbuigbKpsSVBFs3WjE8 CUA7Ht+XXQyuVcf313HG0tkaFQoxyK4KDkTGwVR/HeAAyMGWYx+h3L8MAUND05T3LfHKtbw YRqP7rJSvk++xfVmCA60g== X-UI-Out-Filterresults: notjunk:1;V03:K0:8cssDhiFE2c=:qMlVbvj/evXtBlrf4DiFHa KjiAzJ2KPspRvKgnWZib2CAHbxDXUJBJit39fb5ZZPCAUs4BcTHs1s6obZMX2EgYiA50tO08I DHEG2m5AzKu2BVePAWseHvhQAUqwp5T9orSkg5pYX14KrlILcYNpd11kdro0478pppQXpimql xTrJ1kC8JA5qrCk+DB6w9mH1GyAKoA6CD/vzNJ0VJUhKfybm8XyrZB57LpWEKYBHrXPOn2dhs 3t21oa8+LdDkWW4r4dtE0lZcMnVTeYfUeQ4kUjk2Fq93jxRihJhZiOjaUoOx7Or1xGdjvgZLf rpXAq3kbzdkFYLrw+RV0bU82llVFyHN18hXpLck76Z0jCk8CxXb++41I+XNVkbiXshQ1DtU0l uDw+IadkrZmLxac6W8G16+tr8veV1RTJpC1dpAOxMJQ5WY6TeGWGkSgJrFcd+Vl9aUgz2z245 k+oNPyRixsN8YaYzey8y0/xhNwXDrJFXFFVoGcj3hpvQ1VxpvxJ+WCz6yp0kpNnGsZOkMO1pM 2TQU3oSLBvHSz6V6P1ZJbQfr770YMHsVwxmfA6n151RXWINkVKYgPOzpYOrLE9f1GUsJgyhk0 EBsMBmGpweZ3O4chYh9wx6ghNAXfbR7yyCQuNj1tQ0+icab+L2ofojwrXQtqQird1+mljMG2k NbfUN8lDwctxP4njO+GT/BR34VbRaqUXSV5GgCBUVn5qhnfmPl0PjUOI3IbpvZbgCgOmL8rGJ t4FXNlGH5bMC1tdcz5leRL2f2eKivbPOHgy/WqwgREp0JM/N74lxB3Z/+VY/GdEOkQrSAFtO5 N0HcNfFxuB5cCvpn9FH+EaiK8SVD//+L5HXYtAE33he0lqk542yMszp6/Qy3bKTZ3LrDl8KLA 3pH2H0ukzfALKIFQ/E6wB8jJxKdJiWuE9xfbk0QtiI9VEk6LPyIBwMzUlHAgtt8eWFznnUadx P87AHrPsnIpjVdXwmeXizWtXGgvUsxyg5h//BdfJPiOHNEMlFhfwZ6koec+mWEzWporA+EGJk iXnCwFVtsN7SbEzqYUePWzydN+ReAQFYnPxepRtc64UkKEk+TyKkfsrym2RWLxMziZEN52I3A 2F7RPzuk8/vhmT4tdawzrMLgfXMnoL5h7rbG3wEnlXtSVB+OUkhVwQCMQ== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1652620268; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=zfjd3a7G2qF6DCphekWtVwNCMqX1/Cfiz0xXtVoWix4=; b=LW1lh8tSywri4Ztjk9jZae/656U6SQsDwpjuNWnl1LX+bteNH62g2e2T2bzapM6Jri5kqN LnzSzCTB16p3xfzxMXVqFDTCx6zG11ta58ajEzSz37XJVAfk/n8g+om892kxwbSN14OaBY c2X5mrATZN9VffJr0ap3vCaNRKq5XxgWf9UKAUWNma77fIYRtFTr+dLKmRf965YwXCbBk5 dHhUxu/VL+8/UEt0K/9hsyl/r4ZKVExqLjAkB4eGbLU+fvE5BYINGvJHtaXxzeLrAoP0V4 qfoHTjnrFsN85ujkS0TmxfRHWaqPT+9ej7EClJLHRBZ1OwUi1/a0DD1bdQqcxQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1652620268; a=rsa-sha256; cv=none; b=HNeUOqOOdDvhEFIuK1lrzm6EoptB1NKn3rqIEaRHL70COl1Cfp+np6KoPxd2yNFObQXO/R oWtMOZO110j60A71/8DocaNBZebFzW89G1RYQJdAVKxuiKpoePfYd0VIcQzChdCNRYG0Gw IN3DuoCPA2j0QXpnuWT+1M3X87omk63Engmy+9dl2F5Q+WOI3VytMLnn8p7V9ROFK2Zro/ Ahqy7McDVLOHE4gg57Q+ygWjesHSYb9dSCiFQNBp8no93njKrqQUUw30Nr6qX+o+zAp7HA 1cMCgTve/cGbIVGXInn/ZcPnZdI0jNxVrBkd+7UKVtkTo9ennO1IBsSI5SzhNA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=ZxrQBzyJ; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmx.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 3.47 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=ZxrQBzyJ; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmx.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 1FC02226CA X-Spam-Score: 3.47 X-Migadu-Scanner: scn0.migadu.com X-TUID: J9ueqPGblyw8 --=-=-= Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --==-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Maxime, sorry for the late reply! Maxime Devos writes: > [[PGP Signed Part:Undecided]] > Pierre Langlois schreef op di 29-03-2022 om 20:43 [+0100]: >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; The BUNDLE-VERSION file prevents emacs= -tree-sitter-langs >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; from downloading libraries at load tim= e. > > WDYT of patching emacs-tree-sitter-langs to not download, such that it > doesn't download and run non-Guix libraries behind the user's back? The way the current patchset works, by providing a compatible bundle, we already prevent emacs-tree-sitter-langs from downloading binaries by default. I agree we could go further though, and entirely remove the code that downloads binaries. However I'm not sure about it. Essentially, there is a tree-sitter-langs-build.el file [0] that can either download binaries or fetch sources and compile locally. So a user could decide to opt-out of using Guix binaries and instead use an alternative method. I 100% agree that by default we should make the package use Guix libraries, this way it also /just works/. However, if somebody wants to do things differently, I'm not sure we want to get in the way. In the end, this isn't so different from letting people use an alternative package manager if they like. We'd rather people used Guix of course :-). I don't have a really strong opinion about this though, so if you still prefer to delete the downloading code, I've attached an example patch that entirely replace it with a bare-bones implementation as an example. Let me know what you think! [0]: https://github.com/emacs-tree-sitter/tree-sitter-langs/blob/master/tre= e-sitter-langs-build.el > Also, why do we need a bundle at all, would simply installing emacs- > tree-sitter, and, e.g., tree-sitter-java, just work? Yeah, having a bundle is fundamentally how this package works AFAICT. I think the main reason is that in order to do highlighting effectively in emacs, it's not enough to install the tree-sitter runtime and a tree-sitter- grammar. You also want to "configure" how the highlighting is done by providing custom "queries" expressions. And this package provides queries for every language that it supports: https://github.com/emacs-tree-sitter/tree-sitter-langs/tree/master/queries All that being said, I believe that long-term the idea is that upstream language-specific packages would eventually gain support for tree-sitter and then this bundle "glue" package will no longer be necessary. Especially if one day emacs proper gains native support for tree-sitter (I think I saw some discussions about that on emacs-devel last year). But given this package is quite useful though, I'd be surprised if it goes away soon. Hope this makes sense! Thanks, Pierre > > Greetings, > Maxime. > > [[End of PGP Signed Part]] --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFMBAEBCgA2FiEEctU9gYy29KFyWDdMqPyeRH9PfVQFAmKA+78YHHBpZXJyZS5s YW5nbG9pc0BnbXguY29tAAoJEKj8nkR/T31UEhoH/RFOtPgATPZpLBDnq1Bh4Rft WbZ+x+QktpWy/VZoAe5QFKIStEPQoQLQJK7NOhsHN844w/lSkVLf5DN7MSUQl6BK 6uEAKDp6gUgM8AvvMTd283ZJJwzHL1GE9y8/yX6gXuKxDHko041XhwJTT/xcDCry X3xXTDft39FaC10KNUj+6UJRg1I+q0LF83Sk811L7IR4wVO6TeA/P5is7W51EUD+ M0T8F3VrMxgmnA4/KHBkvs4r/ZAnAPziG5mN69OsdZcWYW3+YhtAJsBaE89Mm8df IygS4yupJsG/4PfurZhm0YXrpLi6PpURUAecmW6sr9O8c2t3mfIlAl8K+x83L9M= =FtGC -----END PGP SIGNATURE----- --==-=-=-- --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-wip.patch Content-Transfer-Encoding: quoted-printable =46rom 7ad62ccef2446011dfbdfb2dbe8cc58f46fb05d8 Mon Sep 17 00:00:00 2001 From: Pierre Langlois Date: Sat, 2 Apr 2022 19:22:52 +0100 Subject: [PATCH] wip =2D-- gnu/packages/tree-sitter.scm | 49 ++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/gnu/packages/tree-sitter.scm b/gnu/packages/tree-sitter.scm index 7e14ebd1e3..d6892db6e3 100644 =2D-- a/gnu/packages/tree-sitter.scm +++ b/gnu/packages/tree-sitter.scm @@ -795,11 +795,11 @@ (define-public emacs-tree-sitter @end enumerate") (license license:expat))) -(define (make-emacs-tree-sitter-langs-grammar-bundle version) +(define emacs-tree-sitter-langs-grammar-bundle (package (name "emacs-tree-sitter-langs-grammar-bundle") (source #f) - (version version) + (version (package-version tree-sitter)) (build-system trivial-build-system) (inputs ;; FIXME: Support for some languages is still left to package. @@ -836,11 +836,7 @@ (define (make-emacs-tree-sitter-langs-grammar-bundle = version) (map (match-lambda ((name directory) (string-append directory "/lib/tree-sit= ter"))) - '#$(package-inputs this-package)))) - ;; The BUNDLE-VERSION file prevents emacs-tree-sitter-l= angs - ;; from downloading libraries at load time. - (call-with-output-file (string-append #$output "/BUNDLE= -VERSION") - (lambda (port) (display #$version port))))))) + '#$(package-inputs this-package)))))))) (synopsis #f) (description #f) (home-page #f) @@ -861,7 +857,7 @@ (define-public emacs-tree-sitter-langs "1p2zbb6ac7wi6x6zpbczcmpkb2p45md2csd2bj43d8s56ckzw5mp")))= ) (build-system emacs-build-system) (inputs - (list (make-emacs-tree-sitter-langs-grammar-bundle version))) + (list emacs-tree-sitter-langs-grammar-bundle)) (propagated-inputs (list emacs-tree-sitter)) (arguments @@ -870,15 +866,36 @@ (define-public emacs-tree-sitter-langs #:test-command ''("script/test") #:phases #~(modify-phases %standard-phases + (add-after 'unpack 'disable-downloader + (lambda _ + (call-with-output-file "tree-sitter-langs-build.el" + (lambda (port) + (let ((on-load-message + (string-append + "tree-sitter-langs: Grammar bundle already inst= alled " + "via Guix. Installing external grammars via th= is " + "function isn't supported, if a language you ne= ed is " + "missing please report a bug at bug-guix@gnu.or= g."))) + (format + port + ";;;###autoload + (defun tree-sitter-langs-install-grammars + (&optional skip-if-installed version os + keep-bundle) + (interactive) + (message \"~a\")) + (defconst tree-sitter-langs--queries-dir + (file-name-as-directory + (concat (file-name-directory (locate-library \"= tree-sitter-langs.el\")) + \"queries\"))) + (defun tree-sitter-langs--bin-dir () \"~a\") + (provide 'tree-sitter-langs-build)" + on-load-message + #$emacs-tree-sitter-langs-grammar-bundle)))))) (add-after 'unpack 'remove-cask (lambda _ (substitute* "script/test" (("cask") "")))) - (add-before 'check 'bundle-for-testing - (lambda* (#:key inputs #:allow-other-keys) - (delete-file-recursively "bin") - (symlink #$(make-emacs-tree-sitter-langs-grammar-bundle ver= sion) - "bin"))) (add-before 'check 'patch-tree-sitter-require-test (lambda _ (use-modules (ice-9 regex)) @@ -906,12 +923,6 @@ (define-public emacs-tree-sitter-langs (lambda _ (delete-file-recursively "queries/hcl") (delete-file-recursively "queries/pgn"))) - (add-before 'install 'install-bundle - (lambda _ - (let ((elpa (elpa-directory #$output))) - (mkdir-p elpa) - (symlink #$(make-emacs-tree-sitter-langs-grammar-bundle v= ersion) - (string-append elpa "/bin"))))) (add-after 'install 'install-queries (lambda* (#:key outputs #:allow-other-keys) (let ((elpa (elpa-directory (assoc-ref outputs "out")))) =2D- 2.36.0 --=-=-=--