From b4797251811cb7d8aa8a49447bb591f3aef2bfbe Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 12 Sep 2023 17:43:20 +0300 Subject: [PATCH] fix(tazjin/emacs): manually hook up tree-sitter grammars The mechanism in nixpkgs does not work, but doing it myself is not that difficult. Change-Id: I91b12e9c1f5d381c9990fd46e02169f5275f88da Reviewed-on: https://cl.tvl.fyi/c/depot/+/9309 Autosubmit: tazjin Reviewed-by: tazjin Tested-by: BuildkiteCI --- users/tazjin/emacs/default.nix | 36 ++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/users/tazjin/emacs/default.nix b/users/tazjin/emacs/default.nix index 1ad77656c..fbec3a9e4 100644 --- a/users/tazjin/emacs/default.nix +++ b/users/tazjin/emacs/default.nix @@ -19,6 +19,23 @@ pkgs.makeOverridable identity = x: x; + # tree-sitter grammars for various ts-modes + customTreesitGrammars = emacs.pkgs.treesit-grammars.with-grammars (g: with g; [ + tree-sitter-bash + tree-sitter-c + tree-sitter-cmake + tree-sitter-cpp + tree-sitter-go + tree-sitter-java + tree-sitter-json + tree-sitter-latex + tree-sitter-nix + tree-sitter-python + tree-sitter-rust + tree-sitter-toml + tree-sitter-yaml + ]); + tazjinsEmacs = pkgfun: (emacsWithPackages (epkgs: pkgfun (with epkgs; [ ace-link ace-window @@ -89,25 +106,9 @@ pkgs.makeOverridable zetteldeft zoxide - # tree-sitter grammars for various ts-modes - (treesit-grammars.with-grammars (g: with g; [ - tree-sitter-bash - tree-sitter-c - tree-sitter-cmake - tree-sitter-cpp - tree-sitter-go - tree-sitter-java - tree-sitter-json - tree-sitter-latex - tree-sitter-nix - tree-sitter-python - tree-sitter-rust - tree-sitter-toml - tree-sitter-yaml - ])) - # Wonky stuff (currentTelega epkgs) + customTreesitGrammars # TODO(tazjin): how is this *supposed* to work?! # Custom depot packages (either ours, or overridden ones) tvlPackages.dottime @@ -153,6 +154,7 @@ pkgs.makeOverridable --no-site-lisp \ --no-init-file \ --directory ${./config} ${if l != null then "--directory ${l}" else ""} \ + --eval "(add-to-list 'treesit-extra-load-path \"${customTreesitGrammars}/lib\")" \ --eval "(require 'init)" $@ '').overrideAttrs (_: {