unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrew Tropin <andrew@trop.in>
To: Christopher Baines <mail@cbaines.net>
Cc: guix-devel@gnu.org
Subject: Re: branch master updated: gnu: emacs: Add TREE_SITTER_GRAMMAR_PATH support.
Date: Sat, 11 Feb 2023 16:35:01 +0400	[thread overview]
Message-ID: <87zg9kgz2i.fsf@trop.in> (raw)
In-Reply-To: <87cz6g5t87.fsf@cbaines.net>

[-- Attachment #1: Type: text/plain, Size: 3934 bytes --]

On 2023-02-11 11:29, Christopher Baines wrote:

> 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.

It could be applied to emacs-next only and we could move it to emacs
later when it updated to 29, but I checked guix refresh --list-dependent
emacs and it shown less than 100 packages so I decided to apply it
straight to emacs, but I forgot that emacs-minimal is inherited from
emacs and I guess you are right and it will affect all the emacs
packages.  Anything we would like to do about it right now?

-- 
Best regards,
Andrew Tropin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2023-02-11 12:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <167610269975.14308.10330520524841229243@vcs2.savannah.gnu.org>
2023-02-11 11:29 ` branch master updated: gnu: emacs: Add TREE_SITTER_GRAMMAR_PATH support Christopher Baines
2023-02-11 12:35   ` Andrew Tropin [this message]
2023-02-11 16:54     ` Andrew Tropin
2023-02-12  0:14       ` Ludovic Courtès
2023-02-12  4:24         ` Andrew Tropin
2023-02-14 12:23         ` ’inherit’ and list-dependent (was Re: branch master updated: gnu: emacs: Add TREE_SITTER_GRAMMAR_PATH support.) Simon Tournier
2023-02-14 19:36           ` Gábor Boskovits
2023-02-21 22:55           ` Ludovic Courtès
2023-02-22  9:17             ` Simon Tournier
2023-02-25 18:10               ` Ludovic Courtès
2023-02-25 19:27                 ` Gábor Boskovits
2023-02-27  9:59                 ` Simon Tournier

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zg9kgz2i.fsf@trop.in \
    --to=andrew@trop.in \
    --cc=guix-devel@gnu.org \
    --cc=mail@cbaines.net \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).