From: Katherine Cox-Buday <cox.katherine.e@gmail.com>
To: Demis Balbach <db@minikn.xyz>
Cc: help-guix@gnu.org, andrew@trop.in, Guix Devel <guix-devel@gnu.org>
Subject: Re: Getting tree-sitter grammars in Guix
Date: Sat, 21 Jan 2023 09:43:23 -0700 [thread overview]
Message-ID: <87o7qrzvmc.fsf@gmail.com> (raw)
In-Reply-To: <87h6wycn8f.fsf@minikn.xyz> (Demis Balbach's message of "Tue, 10 Jan 2023 18:29:04 +0100")
Demis Balbach <db@minikn.xyz> writes:
> Hello, I was wondering what the "correct" way would be to get grammars
> for the tree-sitter library available in Guix when using tree-sitter
> with Emacs 29+.
>
> There is https://github.com/emacs-tree-sitter/tree-sitter-langs, but I
> don't think it has been packaged in Guix yet. I started packaging the
> grammar for JS/TS:
>
> (define-public tree-sitter-javascript
> (let ((commit "7a29d06274b7cf87d643212a433d970b73969016")
> (revision "0")
> (version "0.20.0"))
> (package
> (name "tree-sitter-javascript")
> (version (git-version version revision commit))
> (source
> (origin
> (method git-fetch)
> (uri (git-reference
> (url "https://github.com/tree-sitter/tree-sitter-javascript")
> (commit commit)))
> (sha256
> (base32 "1pk6d9g6a7bzhxmwnvfiycarcgz76wq2rgfqr0xjh7y7swfw5hvw"))
> (file-name (git-file-name name version))))
> (build-system gnu-build-system)
> (native-inputs
> (list gcc))
> (arguments
> `(#:tests?
> #f
> #:phases
> (modify-phases
> %standard-phases
> (delete 'configure)
> (delete 'install)
> (delete 'build)
> (add-after 'unpack 'create-dirs
> (lambda _ (mkdir "lib")))
> (add-after 'create-dirs 'compile
> (lambda* (#:key inputs outputs #:allow-other-keys)
> (let* ((out (assoc-ref outputs "out"))
> (gcc (string-append (assoc-ref inputs "gcc") "/bin")))
> (copy-file "grammar.js" "src/grammar.js")
> (with-directory-excursion
> (string-append "./src")
> (invoke (string-append gcc "/gcc") "-fPIC" "-c" "-I." "parser.c")
> (invoke (string-append gcc "/gcc") "-fPIC" "-c" "-I." "scanner.c")
> (invoke (string-append gcc "/gcc")
> "-fPIC" "-shared" "parser.o" "scanner.o" "-o"
> "libtree-sitter-javascript.so")))))
> (add-after 'compile 'symlink
> (lambda* (#:key inputs outputs #:allow-other-keys)
> (let* ((out (assoc-ref outputs "out"))
> (lib (string-append out "/lib")))
> (install-file "src/libtree-sitter-javascript.so" lib)))))))
> (home-page "https://github.com/tree-sitter/tree-sitter-javascript")
> (synopsis "JavaScript and JSX grammar for tree-sitter.")
> (description "JavaScript and JSX grammar for tree-sitter.")
> (license license:expat))))
>
> But I'm not sure if packaging each grammar is the correct way. I
> hesitate to continue working on this because there are not other
> grammars packaged in Guix (yet). With tree-sitter being built into
> Emacs 29+ I expected grammars to be packaged already (hence why I'm
> asking if this approach is correct).
This seems correct to me, but you might get more informed opinions on
guix-devel@gnu.org (CCed), since this is a packaging question.
>
> Thanks in advance!
--
Katherine
next prev parent reply other threads:[~2023-01-21 16:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-10 17:29 Getting tree-sitter grammars in Guix Demis Balbach
2023-01-21 16:43 ` Katherine Cox-Buday [this message]
2023-01-22 15:38 ` Simon Tournier
2023-02-04 19:27 ` Demis Balbach
2023-02-06 17:25 ` Simon Tournier
2023-02-06 21:01 ` Pierre Langlois
2023-02-07 11:27 ` zimoun
2023-02-08 17:50 ` Demis Balbach
-- strict thread matches above, loose matches on Subject: below --
2023-02-04 4:52 Andrew Tropin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o7qrzvmc.fsf@gmail.com \
--to=cox.katherine.e@gmail.com \
--cc=andrew@trop.in \
--cc=db@minikn.xyz \
--cc=guix-devel@gnu.org \
--cc=help-guix@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.