From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id EDpwE8Pk3WMy1QAAbAwnHQ (envelope-from ) for ; Sat, 04 Feb 2023 05:53:23 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 2N1yE8Pk3WNgDAEAauVa8A (envelope-from ) for ; Sat, 04 Feb 2023 05:53:23 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 0CFE5324D6 for ; Sat, 4 Feb 2023 05:53:22 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pOAXn-0005z3-Ci; Fri, 03 Feb 2023 23:52:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOAXm-0005yf-BI for help-guix@gnu.org; Fri, 03 Feb 2023 23:52:54 -0500 Received: from relay6-d.mail.gandi.net ([2001:4b98:dc4:8::226]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOAXi-0003Vp-3E for help-guix@gnu.org; Fri, 03 Feb 2023 23:52:52 -0500 Received: (Authenticated sender: andrew@trop.in) by mail.gandi.net (Postfix) with ESMTPSA id B6616C0002; Sat, 4 Feb 2023 04:52:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1675486366; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=SV+GrEr6oST29/sUBhkG+JuDFwyDMmvoZ/yhJxtsn5w=; b=pBF0/9x06dYmw+cCCoF4hDtld/7YvPSlaFF9+kLk48QJJzVggcYICi53JTAEHda6bZaCFQ uKoL32d3MrBTa0E5SCBEjB0Igx1v1IG1XH6KNOKyovBk9HaBSMhL8LEH+YlAH8bPsp0Fo8 hcP8zSO/k5fLIk7tdEwBooz25Jav2AmNmtgOOlGxCoZOo/orJtZxY84pvswX8djjvHgMPE jD7tqj5AN8nu+SaroV/6snHQlQyiw8Mu8VYmohvUBgvSZ9EGTdZ476W1qRrCL5DIHv8uOM OZY66sCOwMvXDbduFX9BIWTkX0PtQjaRhb42A+fAsgpdCepjcE6YPecJbcZnbw== From: Andrew Tropin To: Demis Balbach , help-guix@gnu.org Subject: Re: Getting tree-sitter grammars in Guix Date: Sat, 04 Feb 2023 08:52:40 +0400 Message-ID: <87pmaqghgn.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: pass client-ip=2001:4b98:dc4:8::226; envelope-from=andrew@trop.in; helo=relay6-d.mail.gandi.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: help-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1675486403; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=SV+GrEr6oST29/sUBhkG+JuDFwyDMmvoZ/yhJxtsn5w=; b=TGZDHaujptrnldfIiXb8x6dmN1E8jcnvmOVdpiYg56NxvbuID7MLXn1Z3WBflOpz2SEGLt PXgXSp+ozynJGusUFN8ys3tCUn2smnWOUqX0lprmow5E34mEe7XaCyU9LtXOl0HwCPz8f/ 0/I/Xroo0XlNID4RpLRJL8lrYDZTqqrZ399zXz52KLl5siWQFKRjooPL78IWkphYnFhAqP 6yg4cEiHWsCZ2Kd0BdUNOglz7Cq7dsA0Cs6RzsjYpEtvjqQk5RydUAcid9h9xpGKsm8kT2 3jjt+kjLdmxl4jsBe8rwKMLDLNKgGzKheKPpqpz8ivpfx5e4YrqwZAbAzOBorg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=trop.in header.s=gm1 header.b="pBF0/9x0"; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1675486403; a=rsa-sha256; cv=none; b=pZyNoCYmmEWu/OHUCvHS+3nFYEcCtbhGpdO/Jk53xrn2TwMQ+ZhK4SegqCwFG7IxiFZvyr qk+MZqJWgGCsigaqJk7Vl1sczmWFCu5eVHPSbIf/fpKuEaE0IrbYTE+a9sLyfKAvrMIZA0 vQxZMxNZOU+JqkBIFCDsHIX2dnZxOoj0OxeSZbINAJHvxDV3vehCsaqx82l9k7Y8b0HcV+ ptznV5OUHkKMEjWPqsdjRbCnqLScBBM0iH6V4F+qZ8uba5R45KDpWl8pL7VkWThLE5K3f5 Eidkx7VVgAUOO1wPoLMsGKpCsw8dPZGu8MgniYwmVDiDkYdxGdBQBg27tULyqA== X-Migadu-Queue-Id: 0CFE5324D6 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=trop.in header.s=gm1 header.b="pBF0/9x0"; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -11.32 X-Spam-Score: -11.32 X-TUID: WNq/21PkqDFT --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On 2023-01-10 18:29, Demis Balbach 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+. > > 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: > > --8<---------------cut here---------------start------------->8--- > (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)))) > --8<---------------cut here---------------end--------------->8--- > > 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). > > Thanks in advance! Hi Demis! We have some work for tree-sitter done by muradm and he made an example of the function, which returns a package for a tree-sitter grammar for particular language, I think that we want to do something like this: https://yhetil.org/guix-devel/87sfhvm927.fsf@encom.net/3-a.txt Thank you very much for your snippet, I'll experiment a little more with tree-sitter locally and report back with more details. Also, I applied a patch, which enables built-in treesitter in Emacs from this thread: https://yhetil.org/guix-patches/87a6217tw5.fsf@riseup.net/ So I hope we will get tree-sitter support in Guix soon! =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmPd5JgACgkQIgjSCVjB 3rDfXRAAjEqny2FTU8MOvamlNBqapM4LwNF9sDWB63QxuncfmOVCP14+8FWtxag7 /zsFL83AMHSWPzvesFt3wBjrPNl2i2nJNdGnb/C8MbFVSOjgLmF6JlZuY0j6T8kZ vsabc7gsuJM4FMprJkbftb2AxrHhuUKEb3g0iiQX77LX+be/wD3EKujZThFVaAQ2 11wivcGSsxSCohKMLJUZ2rGT9g1OECgGHKrGC/NjDgCXZRZ6SL2JFO+lA2DjYOxm IvmnITKJuHo7bjRz7tksB9keLJpveo6dt5SMYggsSWUVMm7dq2EzVpGm6JDMbClY jgMJJOHJ37nDbaMl8/ddhtzKAZXdT0m9sVgzFqkGMqKzKisSzbC8Vbplt0lDjL5J bujfhB7tFmcQFKKwDzs4tjp6PobzNVK3moZnK8uVlYwn32Tq2YP1bWIXlKOCo9C6 h5xycq3F8v5vOI7tUzzZRsdA8rym+z6sdKR3/UXJMwfShKwhZ0z72MweMQGspiR3 PtKFPnjtoNDKpewqlgXn/xjMMU9Z39ojjEzx3cPlWQLk3RhRa2o/lLoOmZcx7zHg SbPUT6eb7JzRJFtBckv1BdDpnF2EPuArjNr9y094WNVzzs8xOtYuKkSH7BBujenC LmZ/CClJJgzSswK8yUwyhQzXwiB+6Ngmqe2HQSSJkf792OYd2Uw= =62Je -----END PGP SIGNATURE----- --=-=-=--