refactor(lib): generalize ripgrep executables

Amend: 4fcf332749
This commit is contained in:
Henrik Lissner 2024-08-17 03:56:59 -04:00
parent f6040832e5
commit 1977b3dfba
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -469,7 +469,8 @@ will open with point on that line."
(let ((default-directory doom-emacs-dir)) (let ((default-directory doom-emacs-dir))
(split-string (split-string
(cdr (doom-call-process (cdr (doom-call-process
"rg" "--no-heading" "--line-number" "--iglob" "!*.org" doom-ripgrep-executable
"--no-heading" "--line-number" "--iglob" "!*.org"
(format "%s %s($| )" (format "%s %s($| )"
"(^;;;###package|\\(after!|\\(use-package!)" "(^;;;###package|\\(after!|\\(use-package!)"
package))) package)))
@ -694,7 +695,7 @@ config blocks in your private config."
(defvar counsel-rg-base-command) (defvar counsel-rg-base-command)
(defun doom--help-search (dirs query prompt) (defun doom--help-search (dirs query prompt)
;; REVIEW Replace with deadgrep ;; REVIEW Replace with deadgrep
(unless (executable-find "rg") (unless doom-ripgrep-executable
(user-error "Can't find ripgrep on your system")) (user-error "Can't find ripgrep on your system"))
(cond ((fboundp 'consult--grep) (cond ((fboundp 'consult--grep)
(consult--grep prompt #'consult--ripgrep-make-builder (cons data-directory dirs) query)) (consult--grep prompt #'consult--ripgrep-make-builder (cons data-directory dirs) query))
@ -708,7 +709,8 @@ config blocks in your private config."
;; () TODO Helm support? ;; () TODO Helm support?
((grep-find ((grep-find
(string-join (string-join
(append (list "rg" "-L" "--search-zip" "--no-heading" "--color=never" (append (list doom-ripgrep-executable
"-L" "--search-zip" "--no-heading" "--color=never"
(shell-quote-argument query)) (shell-quote-argument query))
(mapcar #'shell-quote-argument dirs)) (mapcar #'shell-quote-argument dirs))
" "))))) " ")))))