[bug#49946] About migrating support from emacs-tree-sitter to treesit
Commit Message
Hi guix,
Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com> writes:
> Hi guix,
>
> I was taking a look at this patch series again and wondering if
> it
> could
> be modified to support the new built in treesit module coming in
> Emacs 29 instead of emacs-tree-sitter, as the latter recommends
> using
> the native integration going forward [1]. Maybe we should leave
> this
> to when
> Emacs 29 is released, but I think working on this in advance
> could
> result on it being delivered earlier, which would be great. What
> do
> you think Pierre?
>
> [1]:
> https://github.com/emacs-tree-sitter/elisp-tree-sitter/commit/d3eab879e9b0ccc9582113d81a93ad06f3c6bfb1
>
> PS: I'm willing to help
>
> Regards,
I played around this idea this weekend and I got `treesit' to use
the Guix installed grammars :) !
First, I applied a patch that added tree-sitter as an input for
emacs-next [1].
[1]: https://issues.guix.gnu.org/61139
Then, I did the edits below on top of Pierre's latest patch
series:
From fb96ca9c6039d07856c8f3525919ed9036b39470 Mon Sep 17 00:00:00 2001
From: Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com>
Date: Sun, 29 Jan 2023 20:24:04 -0300
Subject: [PATCH] Support treesit module from emacs
---
gnu/packages/emacs.scm | 8 +++++++-
guix/build/tree-sitter-build-system.scm | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
Comments
Hi Luis,
Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com> writes:
> Hi guix,
>
> Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com> writes:
>
>> Hi guix,
>>
>> I was taking a look at this patch series again and wondering if it
>> could
>> be modified to support the new built in treesit module coming in
>> Emacs 29 instead of emacs-tree-sitter, as the latter recommends using
>> the native integration going forward [1]. Maybe we should leave this
>> to when
>> Emacs 29 is released, but I think working on this in advance could
>> result on it being delivered earlier, which would be great. What do
>> you think Pierre?
>>
>> [1]:
>> https://github.com/emacs-tree-sitter/elisp-tree-sitter/commit/d3eab879e9b0ccc9582113d81a93ad06f3c6bfb1
>>
>> PS: I'm willing to help
>>
>> Regards,
>
> I played around this idea this weekend and I got `treesit' to use the Guix
> installed grammars :) !
>
> First, I applied a patch that added tree-sitter as an input for emacs-next
> [1]. [1]: https://issues.guix.gnu.org/61139
>
> Then, I did the edits below on top of Pierre's latest patch series:
This is super cool, thanks for looking into this! and sorry for replying
so late. I agree that we should try and get these grammars integrated
into emacs as soon as we can, it's the end goal after all (by that I
mean that I'm not sure the Rust-based emacs module will live on after
emacs 29 is released).
But anyways, it's great that you got it working with minimal changes,
looks like there won't be any blockers :-).
Regarding the patch series, I do have a new version in the pipeline
(fixing style and improving testing) but I'm afraid I've had no time to
work on it in the past month and a half. I should have more time
starting from next weekend.
Thanks!
Pierre
@@ -409,7 +409,13 @@ (define-public emacs-next
(prepend sqlite tree-sitter)))
(native-inputs
(modify-inputs (package-native-inputs emacs)
- (prepend autoconf))))))
+ (prepend autoconf)))
+ (native-search-paths
+ (cons
+ (search-path-specification
+ (variable "TREE_SITTER_GRAMMARS")
+ (files '("lib/tree-sitter")))
+ (package-native-search-paths emacs))))))
(define-public emacs-next-pgtk
(package
@@ -114,7 +114,7 @@ (define (compile-language dir)
"-fno-exceptions"
"-O2"
"-g"
- "-o" ,(string-append lib "/" lang ".so")
+ "-o" ,(string-append lib "/libtree-sitter-" lang ".so")
;; An additional `scanner.{c,cc}' file is sometimes
;; provided.
,@(cond