From patchwork Thu Feb 10 22:55:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Langlois X-Patchwork-Id: 37202 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 0FD5427BBEA; Thu, 10 Feb 2022 23:02:25 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 8738827BBE9 for ; Thu, 10 Feb 2022 23:02:24 +0000 (GMT) Received: from localhost ([::1]:48648 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nIISF-0006hJ-OQ for patchwork@mira.cbaines.net; Thu, 10 Feb 2022 18:02:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37280) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nIIQx-0005YK-Bd for guix-patches@gnu.org; Thu, 10 Feb 2022 18:01:11 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35461) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nIIQx-0007OR-23 for guix-patches@gnu.org; Thu, 10 Feb 2022 18:01:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nIIQx-0001AP-2P for guix-patches@gnu.org; Thu, 10 Feb 2022 18:01:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [WIP PATCH v3 26/26] gnu: Add emacs-tree-sitter-langs. Resent-From: Pierre Langlois Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 10 Feb 2022 23:01:03 +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.16445340484440 (code B ref 49946); Thu, 10 Feb 2022 23:01:03 +0000 Received: (at 49946) by debbugs.gnu.org; 10 Feb 2022 23:00:48 +0000 Received: from localhost ([127.0.0.1]:57589 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nIIQh-00019S-Fh for submit@debbugs.gnu.org; Thu, 10 Feb 2022 18:00:47 -0500 Received: from mout.gmx.net ([212.227.17.22]:42233) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nIIQf-00018t-2Q for 49946@debbugs.gnu.org; Thu, 10 Feb 2022 18:00:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1644534039; bh=Y0ruqogCZF6AfqowFM97UmFau0VQvx63bes3SYbLPDE=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=gjOXK+TNnlbloz3SoJ2xBPxtwDbxoTELoL5efJUg3W2IR95a8/krwC9grjrUz67YC G1BGKNpAPko9zWFSunexhpdmbUn4m5UPQnuUrbqoPGCH1oRC/emicP84ZhxOFHMKYV kUOFq+daq0E3G8z9cuGLvlOKnShsOqNv9gY0jAkM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([82.69.64.142]) by mail.gmx.net (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1N2mFY-1oIxZm3usG-0139fm; Thu, 10 Feb 2022 23:55:39 +0100 From: Pierre Langlois Date: Thu, 10 Feb 2022 22:55:27 +0000 Message-Id: <20220210225527.25189-26-pierre.langlois@gmx.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220210225527.25189-1-pierre.langlois@gmx.com> References: <87leyinxly.fsf@gmx.com> <20220210225527.25189-1-pierre.langlois@gmx.com> MIME-Version: 1.0 X-Provags-ID: V03:K1:2GGimL3vfqRQuOlDeoUhkwvlof28ls/CZZzMu8HfOqo4KnoqMds b2lWugzt45H71brnW9dqz3/GJQUMgSPKPU9rZ7kiyDeij+J+boqWvKUctjLkvg2Tb1762V/ B+Abi3wszLMnOclGf3VhOUplONpN7kBxawCJg9ECNVvkFu0ok4KwZm9Jc5TtTeM9NTqSxr6 vcWOTB5NOjmpY04HDElbQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:5HlD6LLeaqw=:tFaXn4B6uOJ6+fgbPRdJK3 /YAUnLOwAsNSwxyVB7aH9WpVepv1PVOBc1+lLTNS21iSufxRrQPL136RqjVX6oDfbrG7bmput dQIHz8gws2nG+aZeEoVG4KdOybtJAXZNm3lLk0oeC4EZkFCcJ16j92sg+TDB8TNBV7mEk4HJJ XRlrd+GJmkwakmq0Ai5bXdxlD50GNPTmyGM1nxzUxWEW/gyZBwuYj8evkbz+eTMcCLJcJdyuQ QOhGJsG+De3JqYE8aQVgsOWJcazokDrMt5GXj/hJicfouaYjvi0HkOnN0NiNAb189ix1eLkIC 6Lca0+ra3i2ExWURazewpLuLjjj+LoNLrGl5IG17vzmE/H32grhPnuST620/q85wBdB5xjcaS OnzFJ3k0NaXsa4WpUkQeecWZ9pakuGEWu/f5nZnArEcGAKHyvW63Qrc7LtR6pbmUff2yY4rW0 4+KCkNtgrDzKa15wwcyrdQolF65RYUeJBnHL4vIRfIQ3RBcV4HuXs0p+n3+ecdNAqDiZ6M/ew mNCH+/i+Vb4ReJysy+E3pfV/6lhEHsDDSvF7BewJEAuTzUn0I/0SM6vtorQYnGUVl7/15oXyO vPlaM9FLG979YLUey/Z9Ttq9t6yQT/am6AbuXKulROXXqY0EbT895viEW7EuQyEIR2ai7WRA0 xJcVIziDOptDw9vwsRiKE6MbprSoX2xHW42xEInrQ8pYH1wKR9RbIe4hxm3UQrLq3ts9DUQD2 +R0NHXPtGr9t67soH7ymzs4dTciziAZCFK+7WJPoJKao2KXvHDS9wzbp5HrIIqkYw9vWwmocw uQ0QFtxbFhQ8N2GkhwouuA1pXbajxRTktLuupNSzc2FfE3k1hY8s7vzG62FYsRElc6Xf/zJ8F FGM1Ia+tVVBR0kY6p3f1DOzZnS3x2vJuiuB92QR2CmB0mel4thv2wuGyiQNzAcObLinoVqpbQ 4rnuxxx2939dK/1zpLL1Qpxh8RQ8EF+iAWp4CqwRkZH4g6pMxEg/VqdKW5piJexCu6ZaEzMO0 +wG3AG2VSEpgYW7LGixvpOgm22sFA2iXBBLrhdNN3REo+goxT0uHA7QPllzGpWi2cy4dNKxO4 u0GVPWO295pplk= 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/tree-sitter.scm (emacs-tree-sitter-langs): New variable. --- gnu/packages/tree-sitter.scm | 81 ++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) -- 2.34.0 diff --git a/gnu/packages/tree-sitter.scm b/gnu/packages/tree-sitter.scm index b412f3d031..00b91f5c91 100644 --- a/gnu/packages/tree-sitter.scm +++ b/gnu/packages/tree-sitter.scm @@ -725,3 +725,84 @@ (define-public emacs-tree-sitter @item More informative indexing for imenu. @end enumerate") (license license:expat))) + +(define-public emacs-tree-sitter-langs + (package + (name "emacs-tree-sitter-langs") + (version "0.11.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/emacs-tree-sitter/tree-sitter-langs") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0r3yw25czg1vcxk9015yd8p1n0z427z2l4hizfjy8w8jjjg7cxxf")))) + (build-system emacs-build-system) + ;; FIXME: Support for some languages, such as ruby, is still missing from + ;; the bundle. + (inputs + (list tree-sitter-bash + tree-sitter-c + tree-sitter-cpp + tree-sitter-css + tree-sitter-go + tree-sitter-html + tree-sitter-java + tree-sitter-javascript + tree-sitter-json + tree-sitter-julia + tree-sitter-php + tree-sitter-python + tree-sitter-rust + tree-sitter-typescript)) + (propagated-inputs + (list emacs-tree-sitter)) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-before 'build 'fake-bundle + (lambda _ + ;; The BUNDLE-VERSION file prevents the package from + ;; downloading libraries at load time. + (call-with-output-file "bin/BUNDLE-VERSION" + (lambda (port) (display ,version port))))) + (add-after 'install 'install-libs + (lambda* (#:key outputs inputs #:allow-other-keys) + (let ((elpa (elpa-directory (assoc-ref outputs "out")))) + (mkdir-p (string-append elpa "/bin")) + ;; The BUNDLE-VERSION file prevents the package from + ;; downloading libraries at load time. + (call-with-output-file (string-append elpa "/bin/BUNDLE-VERSION") + (lambda (port) (display ,version port))) + + (define (install-lib lang) + (let ((input (assoc-ref inputs (string-append "tree-sitter-" lang)))) + (symlink (string-append input "/lib/tree-sitter/" lang ".so") + (string-append elpa "/bin/" lang ".so")))) + (for-each (lambda (input) + (use-modules (ice-9 regex)) + (cond + ((string-match "^tree-sitter-(.*)$" (car input)) + => (lambda (m) + (install-lib (match:substring m 1)))))) + inputs)))) + (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-level +functionalities on top of tree-sitter, such as code folding, evil text +objects, ...etc. +@end enumerate") + (license license:expat)))