[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#49946] [PATCH v2 33/33] gnu: Add emacs-tree-sitter-langs.
From: |
Pierre Langlois |
Subject: |
[bug#49946] [PATCH v2 33/33] gnu: Add emacs-tree-sitter-langs. |
Date: |
Sun, 29 Aug 2021 11:46:08 +0100 |
* gnu/packages/tree-sitter.scm (emacs-tree-sitter-langs): New variable.
---
gnu/packages/tree-sitter.scm | 80 ++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
diff --git a/gnu/packages/tree-sitter.scm b/gnu/packages/tree-sitter.scm
index 0454d75ad4..6bb52b68ac 100644
--- a/gnu/packages/tree-sitter.scm
+++ b/gnu/packages/tree-sitter.scm
@@ -709,3 +709,83 @@ Emacs packages that understand code structurally. For
example:
@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.10.3")
+ (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
+ "0fa0xi8sky5h3rscnvcci9djdi71qj30vivzzvx7w8pqkmsy1vq7"))))
+ (build-system emacs-build-system)
+ ;; FIXME: Support for some languages, such as bash, is still missing from
+ ;; the bundle.
+ (inputs
+ `(("tree-sitter-bash" ,tree-sitter-bash)
+ ("tree-sitter-c" ,tree-sitter-c)
+ ("tree-sitter-cpp" ,tree-sitter-cpp)
+ ("tree-sitter-css" ,tree-sitter-css)
+ ("tree-sitter-go" ,tree-sitter-go)
+ ("tree-sitter-html" ,tree-sitter-html)
+ ("tree-sitter-java" ,tree-sitter-java)
+ ("tree-sitter-javascript" ,tree-sitter-javascript)
+ ("tree-sitter-json" ,tree-sitter-json)
+ ("tree-sitter-julia" ,tree-sitter-julia)
+ ("tree-sitter-php" ,tree-sitter-php)
+ ("tree-sitter-python" ,tree-sitter-python)
+ ("tree-sitter-rust" ,tree-sitter-rust)
+ ("tree-sitter-typescript" ,tree-sitter-typescript)))
+ (propagated-inputs
+ `(("emacs-tree-sitter" ,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"))))
+ (define (install-lib lang)
+ (let ((input (assoc-ref inputs (string-append "tree-sitter-"
lang))))
+ (copy-file (string-append input "/lib/tree-sitter/" lang
".so")
+ (string-append elpa "/bin/" lang ".so"))))
+ (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)))
+ (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)))
--
2.33.0
- [bug#49946] [PATCH v2 12/33] gnu: Add tree-sitter-c., (continued)
- [bug#49946] [PATCH v2 12/33] gnu: Add tree-sitter-c., Pierre Langlois, 2021/08/29
- [bug#49946] [PATCH v2 28/33] gnu: rust-emacs-module: Update to 0.16., Pierre Langlois, 2021/08/29
- [bug#49946] [PATCH v2 31/33] gnu: Add emacs-tree-sitter-core., Pierre Langlois, 2021/08/29
- [bug#49946] [PATCH v2 25/33] gnu: Add tree-sitter-typescript., Pierre Langlois, 2021/08/29
- [bug#49946] [PATCH v2 23/33] gnu: Add tree-sitter-python., Pierre Langlois, 2021/08/29
- [bug#49946] [PATCH v2 22/33] gnu: Add tree-sitter-php., Pierre Langlois, 2021/08/29
- [bug#49946] [PATCH v2 21/33] gnu: Add tree-sitter-julia., Pierre Langlois, 2021/08/29
- [bug#49946] [PATCH v2 24/33] gnu: Add tree-sitter-rust., Pierre Langlois, 2021/08/29
- [bug#49946] [PATCH v2 26/33] gnu: Add rust-bindgen@0.56., Pierre Langlois, 2021/08/29
- [bug#49946] [PATCH v2 32/33] gnu: Add emacs-tree-sitter., Pierre Langlois, 2021/08/29
- [bug#49946] [PATCH v2 33/33] gnu: Add emacs-tree-sitter-langs.,
Pierre Langlois <=
- [bug#49946] [PATCH v2 33/33] gnu: Add emacs-tree-sitter-langs., Pierre Langlois, 2021/08/29
- [bug#49946] [PATCH v2 30/33] gnu: rust-emacs: Update to 0.17., Pierre Langlois, 2021/08/29
- [bug#49946] [PATCH v2 29/33] gnu: rust-emacs-macros: Update to 0.17., Pierre Langlois, 2021/08/29
[bug#49946] [PATCH 10/31] gnu: Add node-nan., Pierre Langlois, 2021/08/08
[bug#49946] [PATCH 09/31] guix: node-build-system: Support compiling addons with node-gyp., Pierre Langlois, 2021/08/08
[bug#49946] [PATCH 15/31] gnu: Add tree-sitter-html., Pierre Langlois, 2021/08/08
[bug#49946] [PATCH 17/31] gnu: Add tree-sitter-javascript., Pierre Langlois, 2021/08/08
[bug#49946] [PATCH 13/31] gnu: Add tree-sitter-css., Pierre Langlois, 2021/08/08
[bug#49946] [PATCH 12/31] gnu: Add tree-sitter-cpp., Pierre Langlois, 2021/08/08
[bug#49946] [PATCH 11/31] gnu: Add tree-sitter-c., Pierre Langlois, 2021/08/08