From f1290f2f69bfdef664882d6d26281bcd0d74a804 Mon Sep 17 00:00:00 2001 From: Marien Zwart Date: Wed, 6 Mar 2024 00:11:34 +1100 Subject: [PATCH] Fix a doom-snippets snippet shadowing default.el --- elisp-packages.nix | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/elisp-packages.nix b/elisp-packages.nix index 54cf165..5e27c13 100644 --- a/elisp-packages.nix +++ b/elisp-packages.nix @@ -105,15 +105,6 @@ # Use a melpaBuild here so the package ends up in its own directory: # it uses that directory as a snippets directory, and using site-lisp/ as that # might go wrong. - # - # XXX this results in all snippets directories being added to load-path... - # This makes a mess (`(load "default")` ends up loading a snippet...). - # - # Does not look doom-snippets-specific, I also have - # - # /nix/store/...-emacs-packages-deps/share/emacs/site-lisp/elpa/ansible-20240212.325/snippets/text-mode/ansible/f5 - # - # and so forth. doom-snippets = esuper.melpaBuild { pname = "doom-snippets"; version = "1"; @@ -129,5 +120,25 @@ :files (:defaults "*-mode")) ''; packageRequires = [ eself.yasnippet ]; + # Stop all snippets from ending up on load-path via + # normal-top-level-add-subdirs-to-load-path. + # Avoids "default" in one of these from being mistaken for default.el. + preBuild = '' + for d in *-mode; do + touch $d/.nosearch + done + ''; }; + # TODO: clean up some more load-path clutter? + # + # The single biggest contributors are tree-sitter-langs (73) and ansible (36), + # leaving 48 others. + # + # It looks like upstream has the same issue for both of these. + # For tree-sitter-langs, we do use our own generated derivation (because elpa), + # but the problematic directory is package-specific (queries/). + # For ansible, we use upstream's derivation from melpaPackages. + # + # Since it looks like it's not breaking things and the number of entries added + # to load-path is relatively modest I'm leaving this alone for now. }