From: Demis Balbach <db@minikn.xyz>
To: Simon Tournier <zimon.toutoune@gmail.com>, guix-devel@gnu.org
Cc: andrew@trop.in
Subject: Re: Getting tree-sitter grammars in Guix
Date: Sat, 04 Feb 2023 20:27:56 +0100 [thread overview]
Message-ID: <87ilghfcxv.fsf@minikn.xyz> (raw)
In-Reply-To: <86fsc21sw0.fsf@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4440 bytes --]
On 2023-01-22 16:38, Simon Tournier wrote:
> Hi,
>
> On Tue, 10 Jan 2023 at 18:29, Demis Balbach <db@minikn.xyz> wrote:
>
>> 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+.
>
> This raises a question about the bootstrap.
>
> From my understanding, the inputs of Tree-sitter is the file
> ’grammar.js’ and then using Node.js, it generates C files. It is often
> these C files which are considered as the Tree-sitter parser.
>
> Many Tree-sitter parsers are available [1]. For example, Bash [2]. The
> grammar is described by ’grammar.js’ [3] and then using it, the file
> ’src/parser.c’ [4] is generated (note the size 3.46MB!). Then, using
> this file ’src/parser.c’ is generated a library which is called by the
> editor tool (say Emacs tree-sitter [5]).
>
> I am not aware if someone has tried to rebuild using Guix only from the
> grammar.js to a working tree-sitter editing experience.
>
> Well, considering the state of Node.js and Guix, it appears to me
> difficult to debootstrap. And maybe, we should accept a large
> unverified seed for Tree-sitter. Well, I do not know.
>
> What people think? What do we do with Tree-sitter?
>
>
> 1: <https://tree-sitter.github.io/tree-sitter/>
> 2: <https://github.com/tree-sitter/tree-sitter-bash>
> 3: <https://github.com/tree-sitter/tree-sitter-bash/blob/master/grammar.js>
> 4: <https://github.com/tree-sitter/tree-sitter-bash/blob/master/src/parser.c>
> 5: <https://emacs-tree-sitter.github.io/>
>
>
> Cheers,
> simon
Hello Simon,
Thanks for the input. I came across this:
https://lists.gnu.org/archive/html/guix-devel/2022-12/msg00073.html
Maybe this can be used as a foundation. I tested it locally and it works
fine, but I don't know how it needs to be altered in order to be pushed
upstream.
On that note, how would one package an emacs package that leverages
tree-sitter? I want to package https://github.com/isamert/jsdoc.el which
requires tree-sitter. I wrote a package definition where I substituted
My understanding is that I need to provide emacs with tree-sitter
support as an input for that to work. Here's a package definition I wrote:
--8<---------------cut here---------------start------------->8---
(define-public emacs-jsdoc
(let ((commit "2e7c02ff2dc422bc21c405bd90a7092c2f599630")
(revision "0")
(version "0.2"))
(package
(name "emacs-jsdoc")
(version (git-version version revision commit))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/isamert/jsdoc.el")
(commit commit)))
(sha256
(base32 "07sz5lpyqv7ixvnnzdfjkj7f0ykdz31lkljp13pvlf36a6sff4rc"))
(file-name (git-file-name name version))))
(build-system emacs-build-system)
(arguments
`(#:phases
(modify-phases
%standard-phases
(add-after 'unpack 'patch-bin
(lambda* (#:key inputs outputs #:allow-other-keys)
(substitute* "jsdoc.el"
(("'tree-sitter") "'treesit")))))))
(inputs
(list
;; tree-sitter
emacs-next-pgtk-stable
emacs-s
emacs-dash))
(home-page "https://github.com/isamert/jsdoc.el")
(synopsis "Inserts JSDoc function comments/typedefs easily.")
(description "Inserts JSDoc function comments/typedefs easily.
It also tries to infer types by itself while doing that.
Type inference is quite primitive.")
(license license:gpl3+))))
--8<---------------cut here---------------end--------------->8---
My understanding is that I need to provide emacs with tree-sitter
support as an input for this to work, which I did, but it'll fail with
--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (file-missing "Cannot open load file" "No such file or directory" "treesit")
--8<---------------cut here---------------end--------------->8---
Maybe someone can help me here. I tried looking at other package
definitions, but I don't know if there are any emacs packages that
require tree-sitter packaged in Guix yet.
Thanks in advance.
--
Best regards / Mit freundlichen Grüßen,
Demis Balbach
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2023-02-04 20:20 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
2023-01-22 15:38 ` Simon Tournier
2023-02-04 19:27 ` Demis Balbach [this message]
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=87ilghfcxv.fsf@minikn.xyz \
--to=db@minikn.xyz \
--cc=andrew@trop.in \
--cc=guix-devel@gnu.org \
--cc=zimon.toutoune@gmail.com \
/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.