From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id yGoSM6cD12NB1AAAbAwnHQ (envelope-from ) for ; Mon, 30 Jan 2023 00:39:19 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id ADgSM6cD12MSZQAA9RJhRA (envelope-from ) for ; Mon, 30 Jan 2023 00:39:19 +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 67FF3534D for ; Mon, 30 Jan 2023 00:39:19 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pMHGQ-0004Mv-Is; Sun, 29 Jan 2023 18:39:10 -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 1pMHGK-0004Mb-LR for guix-patches@gnu.org; Sun, 29 Jan 2023 18:39:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pMHGI-0000y7-VX for guix-patches@gnu.org; Sun, 29 Jan 2023 18:39:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pMHGI-00067P-HV for guix-patches@gnu.org; Sun, 29 Jan 2023 18:39:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] About migrating support from emacs-tree-sitter to treesit Resent-From: Luis Henrique Gomes Higino Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 29 Jan 2023 23:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49946 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49946@debbugs.gnu.org, Pierre Langlois Received: via spool by 49946-submit@debbugs.gnu.org id=B49946.167503551623488 (code B ref 49946); Sun, 29 Jan 2023 23:39:02 +0000 Received: (at 49946) by debbugs.gnu.org; 29 Jan 2023 23:38:36 +0000 Received: from localhost ([127.0.0.1]:45589 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMHFr-00066k-Eo for submit@debbugs.gnu.org; Sun, 29 Jan 2023 18:38:35 -0500 Received: from mail-ot1-f54.google.com ([209.85.210.54]:44761) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMHFp-00066Y-Nx for 49946@debbugs.gnu.org; Sun, 29 Jan 2023 18:38:34 -0500 Received: by mail-ot1-f54.google.com with SMTP id g21-20020a9d6495000000b0068bb336141dso2249448otl.11 for <49946@debbugs.gnu.org>; Sun, 29 Jan 2023 15:38:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:in-reply-to:date:subject:to:from:user-agent :references:from:to:cc:subject:date:message-id:reply-to; bh=HBf+x/T9pKbyKgZRIGA0WRH0PLgpnX9Zz96QVm6JP5k=; b=NF8XpYJscWxLe9kwisXGMmeXMDjQ2atg00oIjU3a+VkMRTslr/HlY45OBklCz2qaUb N0Fzf4c8pnyJfKo/4fzhNP1O75Oqf0D6eoP2KAmrc8yhsndfcxVLGWsgQ7azopM1hH2M AfNW8Eotf9Ho0eRQOyWjlqcMbQus5t7VwFWMIVMeGoCsrBdEJKsaNFBXJwT98E24G8sH GZ+gZXWV/5jjIBhHtnc7I4vqE4RAdN5RSba8B0+BiHSR4KIFi6nencdCIbUnLVGB/QBr v8hiimM5u2LzYcgBEXdGIc1oLIywRZJjoyQ8TBisY+0luFLpP1Isq3vKXtakp34//t0l BJ6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:in-reply-to:date:subject:to:from:user-agent :references:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=HBf+x/T9pKbyKgZRIGA0WRH0PLgpnX9Zz96QVm6JP5k=; b=tJaACdUN3HxmD8yNrKAbYNbeDh4VvEpXKV4uXx5s6XnhSQ+mE23QQOdjPpadP9NjyJ qSqMSuAjdj7Wvu9W0KkSzGVcN6xt70QxZpBA38Z0UvtPwEpzYUOwVxjCgXN3Qo33BY5a SUW1T4PNGUVtFKE1FVVEvSHWyUs8kgRhuwbcTO9I74WGoDtizRWLc9awniPN8ZPa3Mf6 2b9/Bbsgyxlu33pf0ljB1uf8swVc+MubE2IOgnqOAnSGSR9jg6fwQUAWsPoI5WV1e0Hc dR1htJt+NjwlP+yj6jthn4l2jcTLpxQuUU/hxGn2bt/0Vus2JhXUx8n+Zzzzb2lOaDey V/7Q== X-Gm-Message-State: AO0yUKXQd+kqyBd3Fqk1SfwRuXknutNzPWlza6gNZjN0nFkiLc+7034V QaXX9CFauqOnVmsLELfZLlc= X-Google-Smtp-Source: AK7set9BX7UgzioENIO+bGqGe75JT4xR6JQKiIBiJQ2rJpvgY/M8pu6f8y8t6GcyFaN2bv1l6YVAYg== X-Received: by 2002:a9d:7844:0:b0:686:50ca:7404 with SMTP id c4-20020a9d7844000000b0068650ca7404mr3001621otm.4.1675035507973; Sun, 29 Jan 2023 15:38:27 -0800 (PST) Received: from LenovoGuix ([2804:1b3:c201:933a:c214:2125:64ba:ee10]) by smtp.gmail.com with ESMTPSA id y12-20020a056830070c00b0068bcb290a38sm1542865ots.55.2023.01.29.15.38.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Jan 2023 15:38:27 -0800 (PST) References: <874jsemfcy.fsf@gmail.com> User-agent: mu4e 1.8.13; emacs 28.2 From: Luis Henrique Gomes Higino Date: Sun, 29 Jan 2023 20:10:18 -0300 In-reply-to: <874jsemfcy.fsf@gmail.com> Message-ID: <874js8ewsw.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-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=1675035559; 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:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=HBf+x/T9pKbyKgZRIGA0WRH0PLgpnX9Zz96QVm6JP5k=; b=iIHzWe9Zh3CYQwQWWnSjhXWiUCfTHHOEKYfkpOAmszpWJI24TaiVUDhysC0gyFa6QoIFiY mYANeocxbBHPG9ypm7va2lvUMv5UjmhuvxkyVzCEsnd6uOPCXrXAbY2RBYGJqyTg1KGPCn rDj2+gjnFPpBQ9j7U9BRPjIXP9RFG14cFggjp92ocvrwpMgAnhPsWpGb7UwT6MUIJqtcxH qurrg3g8jNukGojYMLz4RDMYVCDn9qNd0nTCm84HE+guXLmLViovHEvD5REOWo+UKlun3N YSW8TM2Yx/SPslI8EKlhFHeImnB1gJIEkXkGnUN54CH0SxCReZJ3aWuWBDozwA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=NF8XpYJs; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1675035559; a=rsa-sha256; cv=none; b=WNchdok4beUMuTuWcl52ACpMiaOXaBs2oH05s/q3uEGWsktJUvxzl74l67MI+rGkphkb7r 9QRCsKld5GH76zcVyaWRdX0dZuW9cOGGH7JGO8oCgkKeXN/KLR9xCCuN0ESWpTn7y32/cO 538+Wl/t1UwtdeikRX4botCzZVFbK+L+FghQhK5BEqLTZFuFjbB1uDgIO7y+3SCFMLhz8Z o+L9RPbYvKljM1jwwv1qOmy4b1M2fjwjCTuVm6BnNjVqKilxag8ZA9Y+cdHWGGeHiyaMl0 0tFNOyrYgVuBFwlBEDlvFyaOAscP9AQIh597/Fjb5gklb0hIIHAdkuWpw2Qp/A== X-Spam-Score: 5.92 X-Migadu-Spam-Score: 5.92 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=NF8XpYJs; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 67FF3534D X-Migadu-Scanner: scn1.migadu.com X-TUID: uUOBSEXccMPU --=-=-= Content-Type: text/plain; format=flowed Hi guix, Luis Henrique Gomes Higino 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: --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=0001-Support-treesit-module-from-emacs.patch >From fb96ca9c6039d07856c8f3525919ed9036b39470 Mon Sep 17 00:00:00 2001 From: Luis Henrique Gomes Higino 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(-) diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index 951c1ad6df..193547ff42 100644 --- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -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 diff --git a/guix/build/tree-sitter-build-system.scm b/guix/build/tree-sitter-build-system.scm index 574b0f2a1c..ee1aa9976c 100644 --- a/guix/build/tree-sitter-build-system.scm +++ b/guix/build/tree-sitter-build-system.scm @@ -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 -- 2.39.1 --=-=-= Content-Type: text/plain; format=flowed Then, I ran `./pre-inst-env guix shell emacs-next tree-sitter-c tree-sitter-cpp --container --preserve="^TERM$" -- emacs -Q -nw` and executed the following code inside that Emacs session: --8<---------------cut here---------------start------------->8--- (defvar guix-treesit-grammar-paths (let ((grammars-path (if (getenv "TREE_SITTER_GRAMMARS") (getenv "TREE_SITTER_GRAMMARS") ""))) (split-string grammars-path ":"))) (if (treesit-available-p) (setq treesit-extra-load-path guix-treesit-grammar-paths)) --8<---------------cut here---------------end--------------->8--- Doing these steps, Emacs' treesit was able to use the grammars installed by Guix in c-ts-mode. I don't know if a native search-path is the appropriate approach or how to include the above elisp (or something similar) in the emacs-next package, but I hope this helps Pierre or anyone else with more understanding to do the v8 of this patch series :). Regards, -- Luis H. Higino --=-=-=--