fix(vertico): use consult-fd only with new enough fd

This commit is contained in:
Itai Y. Efrat 2023-12-09 23:03:10 +02:00
parent 190a37043c
commit 1584f8a61e

View File

@ -210,8 +210,21 @@ targets."
;;;###autoload
(defun +vertico/consult-fd-or-find (&optional dir initial)
"Runs consult-fd if fd version > 8.6.0 exists, consult-find otherwise.
See URL `https://github.com/minad/consult/issues/770'."
(interactive "P")
(if doom-projectile-fd-binary
;; TODO this condition was adapted from a similar one in lisp/doom-projects.el, to be replaced with a more robust check post v3
(if (when-let*
((bin (if (ignore-errors (file-remote-p default-directory nil t))
(cl-find-if (doom-rpartial #'executable-find t)
(list "fdfind" "fd"))
doom-projectile-fd-binary))
(version (with-memoization doom-projects--fd-version
(cadr (split-string (cdr (doom-call-process bin "--version"))
" " t))))
((ignore-errors (version-to-list version))))
;; TODO remove once fd 8.6.0 is widespread enough to be the minimum version for doom
(version< "8.6.0" version))
(consult-fd dir initial)
(consult-find dir initial)))