nix-doom-emacs-unstraightened/pre-init.el
Marien Zwart 708e180792
Make Doom search config with ripgrep, not git
Doom's package help uses `git grep` to search for files in Doom
configuring a package, which does not work for us because our Doom
install does not live in a Git checkout. Unfortunately this breaks
package help completely because of error handling problems.

Add advice to use ripgrep instead, which fixes package help.

I don't like doing this: I've sent the same fix upstream, if it's not
accepted there I may just make Doom in the Nix store be a Git checkout.
2024-04-27 13:12:47 +10:00

35 lines
1.4 KiB
EmacsLisp

;;; pre-init.el -*- lexical-binding: t; -*-
;; Added to init.el by nix-doom-emacs-unstraightened
(defadvice! nix-doom-skip-core-packages (&rest _)
"HACK: don't install straight and core packages.
`doom-initialize-core-packages' would no-op out if
`straight-recipe-repositories' is set, but we do not want to set
it. Just skip it entirely."
:override #'doom-initialize-core-packages
(doom-log "nix-doom-emacs-unstraightened overriding core package init")
;; doom-initialize-core-packages normally registers recipes, which loads the
;; build cache by side effect, which leaves straight--build-cache available
;; afterwards. Doom assumes this cache is available, so force a load here.
(straight--load-build-cache))
(after! doom-packages
(setq straight-base-dir unstraightened--straight-base-dir))
;; TODO: remove if Doom accepts https://github.com/doomemacs/doomemacs/pull/7849
(defadvice! nix-doom-configs-without-git (package)
"Override to use ripgrep instead of git."
:override #'doom--help-package-configs
(let ((default-directory doom-emacs-dir))
(split-string
(cdr (doom-call-process
"rg" "--no-heading" "--line-number" "--iglob" "!*.org"
(format "%s %s($| )"
"(^;;;###package|\\(after!|\\(use-package!)"
package)))
"\n" t)))
;; nix-doom-emacs-unstraightened additions end here.
;; Original init.el follows.