From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id GNjPCGKyD2IYoQAAgWs5BA (envelope-from ) for ; Fri, 18 Feb 2022 15:51:14 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id cF2VAWKyD2KLWgEAG6o9tA (envelope-from ) for ; Fri, 18 Feb 2022 15:51:14 +0100 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 57A8E25BB6 for ; Fri, 18 Feb 2022 15:51:13 +0100 (CET) Received: from localhost ([::1]:45126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nL4bI-0007uf-C0 for larch@yhetil.org; Fri, 18 Feb 2022 09:51:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44736) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nL4WK-0002I0-GR for guix-patches@gnu.org; Fri, 18 Feb 2022 09:46:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:59970) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nL4WK-0006RB-3l for guix-patches@gnu.org; Fri, 18 Feb 2022 09:46:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nL4WK-0000F7-2e for guix-patches@gnu.org; Fri, 18 Feb 2022 09:46:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [PATCH v4 31/31] gnu: Add emacs-tree-sitter-langs. Resent-From: Pierre Langlois Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 18 Feb 2022 14:46:04 +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: 49946@debbugs.gnu.org Cc: Pierre Langlois Received: via spool by 49946-submit@debbugs.gnu.org id=B49946.1645195517820 (code B ref 49946); Fri, 18 Feb 2022 14:46:04 +0000 Received: (at 49946) by debbugs.gnu.org; 18 Feb 2022 14:45:17 +0000 Received: from localhost ([127.0.0.1]:53861 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nL4VY-0000D5-SC for submit@debbugs.gnu.org; Fri, 18 Feb 2022 09:45:17 -0500 Received: from mout.gmx.net ([212.227.17.21]:37907) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nL4VS-0000Ba-9A for 49946@debbugs.gnu.org; Fri, 18 Feb 2022 09:45:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1645195504; bh=KQKtk/Htaalubl8Qbew8r1AMYScY44rvz5nDNhyGK70=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=ErTac/D165TjUudgHhD33mLhCE7OwFwBFBhqw+PbRZkTpP/hzZTloxQ1Bm//IjE2N w1obXrMw7LdrMnTEdVZIQTFgJ/8I1mELNN1FTU2e7uXJpBEC6t2gUlIAtloD1zEENR VoVsOPeBf3YLWeMpryectZH0/azBYXuvTzahexhY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([82.69.64.142]) by mail.gmx.net (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MeCtj-1nsCJw34y7-00bH8E; Fri, 18 Feb 2022 15:40:03 +0100 From: Pierre Langlois Date: Fri, 18 Feb 2022 14:39:48 +0000 Message-Id: <20220218143948.28989-31-pierre.langlois@gmx.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220218143948.28989-1-pierre.langlois@gmx.com> References: <877d9s2qa9.fsf@gmx.com> <20220218143948.28989-1-pierre.langlois@gmx.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:gfPn5D495JujHjxoOvXFmlgEwmkgp2xmT7B2kilVOS7G96lQJua lqADVp3VxDCRuj31rqszRskRjNFpnZDDcSKuphHvIleXA0mZp8B4aUu3kMPsQiCsQVohCoh omysZKQsGufNbogJNioAaQMjlmoTMnQ+4hm6/QuIoLH5xhoJI0VMmZB7kDFYZKr4cTrL5CP J7lxialsEZzVNj3fCg++Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:8FKs1noL39Y=:SHgy61yQIvoYdCCSVpq4Ri HlmNuZY5HGN3cYk6quPbSeSn7IVQZkO4hGqq4as27hSdqjKsQBGo5wPRVkpG3yswqy97LIRGc sJ7hxJIqFWphHq3jvTUVFesPuUq6CTnNryUDO++h800puv+AB+TCcQm6MZYrVSMmqSg+NLV4W zjr+J6teJbqSyaHrheZnAXnJRLDAcYZfLveLqzY3g1CaYIHwq7ODh2pjhQzKVae5h9dK1KuFQ 6liN+0TRu7FmDlSOvare9GvNu7D9EwEYs/ymzAUjNFbhI0lUKk4QODzRU1vYZUkjEvwjG14g/ ZcrB1o0Z4np7GoGP1Fct+U9DMOzOouSzfWut0SzmqnJsV3VyNEhmC2vCmfMvSlbXcVrT8nDyY Vkfk/+TZryHmT58qBgl+vckw42SK0BUVfYARljSF0pLrGTlxLc2fO07vENBCwK0iHgvwec0W9 AleAVaBdhZLQvkIcjQ4r70WTd7HsxdZ+x9Yf39dnnb3e1jehs1GxRg/TeXN4W5/+zS1oGqupE adxwiGbg9DZTL+ETzURmBUB2m6kfJnzvrCSCw1F1gERTrAHUPhDVKGpPOaHES3eDxcPGdgcfj LgplbgjJrTsI2A2Ul0gkw5iS7131zoYnRyDDkgfiFn6aQsm4ghwxzXUnpz56jZPahUYnZH/UO bWJOC3HLlniefzBp03EF8CcvrfSfitqx5rcYuuKGrRZaz/ytf13GXnDSSi+xhEbaUZf0G3xp3 v9CySP7/uef6zpR7rWwio9nuZXMiYGebqRswWroq6z6Cbzu8zOmzmpUgDQ8HPIs/jEmkptnmM xvJ7Q2DyrCuYJV0BYTTfW3eisPjiyO93xhryZz1i13i9OXGnWgY5zKksAj7dGgOQYZKFL13GX ourH5T80FGIBX+NY3psq3/rn4WSPBYodRF4KepqfVFbTSzVfnX8Xz83Qv7iCcCfvmsJj+VPor xjOYX5hDacqflTz8JGsLn848nNtfG/ayCalvDVnVmJ7Z7b13WnfIdWyMy4wwtxBjgodidJYsH z+vSW5eZNFAbF6rV9T7S4SkSUuMn6O+sV0ZBEurwPSGmC17Po307Rc666L2axKthedSqdUk1o 7WyekP3tTbGM2A= 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-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1645195873; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: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=eg68kGt3fZTZbbijGCz1VGFxNulgOyq13QZdDQ/KNX8=; b=i1yZx2v/VSoctALnkbCv6Tp89u4RP2lKztSe6ySS8HuZ3/mLFoSh0Fn1JxyRaF7DBy3w+b rZGdniaVCT0lrWZN0K/AWJRQoB8kWfu51N4/JjhulBSSvy9wggqD10HgAoUX5z0mSMBNLZ NHdWi+FxtnWosQAt2nc6TQsZlS64ED/vjYpH0y8dphx6YbbXWKkFxQRugQp04rFCjIerC1 vO0s/hK0ePFpWOFTIlHFByArENtKJ67oBM3vP61CPWxlvhl0lFCyyFI/rFIbmFgYH2FSIB PQqkTdrknJE8wcEgpLUNECAw8BHwegSKlm1UXn1OPL5j1HOLTZEnYltx0NVTDA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1645195873; a=rsa-sha256; cv=none; b=Zd05Rc1Ptso0ghPqFzo1MjI5crMkSYKK3vkoVlgkQUwTtrZ4UT9b7R+mgRJYauC9QfPJzC gVw2t0eL6Ym8X7whviVCEtqIKWvNFStHpvGt+FW8XfnRCyaW7FMyCehmfjAVr3YjFWOJW8 Ph2CcmMadZ5LWtaWrKxi/GJqo2PjtuwTKaZGoBYQFQrQW0E7Ymp2KInACKlsLX0Uh1DiWL SpuM5cOP2+x3hyrcEtjGHlk7UrVTOmVVyO1mE90Jv0WBZXFl9xyFuZDNCMAt92QwmxY4fu WuafcAcrm/ZHOiVr8Qbvd+qZ9VtwgCgCtbpw9c3eZkHWsz7NrmgE7uhRdybBjA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b="ErTac/D1"; 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: -1.03 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b="ErTac/D1"; 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: 57A8E25BB6 X-Spam-Score: -1.03 X-Migadu-Scanner: scn0.migadu.com X-TUID: 5aW9Dfg5wlUF * gnu/packages/tree-sitter.scm (tree-sitter-langs-grammar-bundle, emacs-tree-sitter-langs): New variables= . =2D-- gnu/packages/tree-sitter.scm | 136 +++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) diff --git a/gnu/packages/tree-sitter.scm b/gnu/packages/tree-sitter.scm index 9a427bed7f..d1341a2ddd 100644 =2D-- a/gnu/packages/tree-sitter.scm +++ b/gnu/packages/tree-sitter.scm @@ -23,6 +23,7 @@ (define-module (gnu packages tree-sitter) #:use-module (guix build-system emacs) #:use-module (guix build-system gnu) #:use-module (guix build-system node) + #:use-module (guix build-system trivial) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix packages) @@ -950,3 +951,138 @@ (define-public emacs-tree-sitter @item More informative indexing for imenu. @end enumerate") (license license:expat))) + +(define tree-sitter-langs-grammar-bundle + (package + (name "tree-sitter-langs-grammar-bundle") + (source #f) + (version "0.11.3") + (build-system trivial-build-system) + (inputs + ;; FIXME: Support for some languages is still left to package. + (list tree-sitter-bash + tree-sitter-c + tree-sitter-c-sharp + tree-sitter-cpp + tree-sitter-css + tree-sitter-elixir + tree-sitter-elm + tree-sitter-go + tree-sitter-html + tree-sitter-java + tree-sitter-javascript + tree-sitter-json + tree-sitter-julia + tree-sitter-ocaml + tree-sitter-php + tree-sitter-python + tree-sitter-rust + tree-sitter-ruby + tree-sitter-typescript)) + (arguments + (list #:builder + (with-imported-modules '((guix build union) + (guix build utils)) + #~(begin + (use-modules (ice-9 match) + (guix build union) + (guix build utils)) + (union-build + #$output + (filter directory-exists? + (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))))))) + (synopsis #f) + (description #f) + (home-page #f) + (license #f))) + +(define-public emacs-tree-sitter-langs + (package + (name "emacs-tree-sitter-langs") + (version "0.11.3") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/emacs-tree-sitter/tree-sitte= r-langs") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1sgpsjd3037pbvwk7lgw70gb4j0fyqikv4lwxwa6l5dwnqvqxgq6")))= ) + (build-system emacs-build-system) + (inputs + (list tree-sitter-langs-grammar-bundle)) + (propagated-inputs + (list emacs-tree-sitter)) + (arguments + (list + #:tests? #t + #:test-command ''("script/test") + #:phases + #~(modify-phases %standard-phases + (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 #$tree-sitter-langs-grammar-bundle "bin"))) + (add-before 'check 'patch-tree-sitter-require-test + (lambda _ + (use-modules (ice-9 regex)) + ;; This test needs a git repositories with submodules for + ;; each languages in order to map all repositories. We pat= ch + ;; the mapping function with one that invokes the tests for= each + ;; packaged language. + (let ((supported-languages + (map (lambda (lib) + (match:substring + (string-match "(.*)\\.so$" (basename lib)) + 1)) + (find-files "bin" "\\.so$")))) + (substitute* "tree-sitter-langs-tests.el" + (("tree-sitter-langs--map-repos") + (call-with-output-string + (lambda (port) + (write `(lambda (fn) + (dolist (lang ',supported-languages) + (funcall fn lang))) + port)))))))) + ;; Tests for queries will fail given those languages are not + ;; packages yet. + (add-before 'check 'remove-unused-highlight-queries + (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 #$tree-sitter-langs-grammar-bundle + (string-append elpa "/bin"))))) + (add-after 'install 'install-queries + (lambda* (#:key outputs #:allow-other-keys) + (let ((elpa (elpa-directory (assoc-ref outputs "out")))) + (copy-recursively "queries" (string-append elpa "/queries= ")))))))) + (home-page "https://ubolonton.github.io/emacs-tree-sitter/languages/"= ) + (synopsis "Language support bundle for Tree-sitter") + (description "This package is a convenient language bundle for +Tree-sitter. For each supported language, this package provides: + +@enumerate +@item Pre-compiled grammar binaries. +@item An optional highlights.scm file that provides highlighting patterns= . +This is mainly intended for major modes that are not aware of tree-sitter= . +@item Optional query patterns for other minor modes that provide high-lev= el +functionalities on top of tree-sitter, such as code folding, evil text +objects, ...etc. +@end enumerate") + (license license:expat))) =2D- 2.34.0