guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: branch master updated: gnu: emacs: Add TREE_SITTER_GRAMMAR_PATH supp


From: Christopher Baines
Subject: Re: branch master updated: gnu: emacs: Add TREE_SITTER_GRAMMAR_PATH support.
Date: Sat, 11 Feb 2023 11:29:26 +0000
User-agent: mu4e 1.8.11; emacs 28.2

guix-commits@gnu.org writes:

> This is an automated email from the git hooks/post-receive script.
>
> abcdw pushed a commit to branch master
> in repository guix.
>
> The following commit(s) were added to refs/heads/master by this push:
>      new c77a3d4554 gnu: emacs: Add TREE_SITTER_GRAMMAR_PATH support.
> c77a3d4554 is described below
>
> commit c77a3d4554175ee5320ccc713aa21b1ba3e6b8a3
> Author: Andrew Tropin <andrew@trop.in>
> AuthorDate: Fri Feb 10 12:32:12 2023 +0400
>
>     gnu: emacs: Add TREE_SITTER_GRAMMAR_PATH support.
>     
>     gnu/packages/emacs.scm (emacs)[native-search-paths]: Add a search-path for
>     tree-sitter grammars.
>     gnu/packages/aux-files/emacs/guix-emacs.el: Add directories from
>     TREE_SITTER_GRAMMAR_PATH to treesit-extra-load-path.
> ---
>  gnu/packages/aux-files/emacs/guix-emacs.el |  7 +++++++
>  gnu/packages/emacs.scm                     | 10 +++++++++-
>  2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/aux-files/emacs/guix-emacs.el 
> b/gnu/packages/aux-files/emacs/guix-emacs.el
> index 56dbcb8d67..708093267d 100644
> --- a/gnu/packages/aux-files/emacs/guix-emacs.el
> +++ b/gnu/packages/aux-files/emacs/guix-emacs.el
> @@ -76,6 +76,13 @@ The files in the list do not have extensions (.el, .elc)."
>                     (when (file-directory-p pkg-dir)
>                       (package-load-descriptor pkg-dir)))))))))))
>  
> +;; If emacs built with tree-sitter, read the value of the environment 
> variable
> +;; to make tree-sitter grammars available in emacs out-of-the-box.
> +(with-eval-after-load 'treesit
> +  (when-let ((grammar-path (getenv "TREE_SITTER_GRAMMAR_PATH")))
> +    (mapcar (lambda (x) (add-to-list 'treesit-extra-load-path x))
> +            (split-string grammar-path ":"))))
> +
>  (provide 'guix-emacs)
>  
>  ;;; guix-emacs.el ends here
> diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
> index 4ce41deb88..b6a66bafac 100644
> --- a/gnu/packages/emacs.scm
> +++ b/gnu/packages/emacs.scm
> @@ -367,7 +367,15 @@
>              (files '("lib/emacs/native-site-lisp")))
>             (search-path-specification
>              (variable "INFOPATH")
> -            (files '("share/info")))))
> +            (files '("share/info")))
> +           ;; tree-sitter support is not yet available in emacs 28, but this
> +           ;; search path won't harm and also will be beneficial for
> +           ;; emacs-next and other emacs-* packages, which have tree-sitter
> +           ;; support enabled.  Please, remove this comment, when emacs
> +           ;; package is updated to 29.
> +           (search-path-specification
> +            (variable "TREE_SITTER_GRAMMAR_PATH")
> +            (files '("lib/tree-sitter")))))
>  
>      (home-page "https://www.gnu.org/software/emacs/";)
>      (synopsis "The extensible, customizable, self-documenting text editor")

The change to guix-emacs.el is pretty impactful here since that affects
all the emacs packages including emacs-minimal I think.

If I've understood your comment correctly, that does seem pretty
wasteful since those rebuilds because of the changed emacs-minimal won't
have any affect since it's version 28 and not 29, right? I think
applying this change to just emacs-next would have been possible.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]