From a55e4a5aaccb75e453fe98a68df0780ebdf1178a Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 10 Jan 2025 11:14:03 -0500 Subject: [PATCH] docs(vertico): suppress grep warnings if ripgrep is available Fix: #8231 --- modules/completion/vertico/doctor.el | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/modules/completion/vertico/doctor.el b/modules/completion/vertico/doctor.el index 943e12244..db18883ca 100644 --- a/modules/completion/vertico/doctor.el +++ b/modules/completion/vertico/doctor.el @@ -7,12 +7,14 @@ module))) (when (require 'consult nil t) - ;; FIXME: This throws an error if grep is missing. - (unless (consult--grep-lookahead-p "grep" "-P") - (warn! "The installed grep binary was not built with support for PCRE lookaheads") - (explain! "Some advanced consult filtering features will not work as a result, see the module readme.")) - - ;; TODO: Move this to core in v3.0 - (unless (consult--grep-lookahead-p "rg" "-P") - (warn! "The installed ripgrep binary was not built with support for PCRE lookaheads.") - (explain! "Some advanced consult filtering features will not work as a result, see the module readme."))) + (if (executable-find "rg") + ;; TODO: Move this to core in v3.0 + (unless (consult--grep-lookahead-p "rg" "-P") + (warn! "The installed ripgrep binary was not built with support for PCRE lookaheads.") + (explain! "Some advanced consult filtering features will not work as a result, see the module readme.")) + (if (executable-find "grep") + (unless (consult--grep-lookahead-p "grep" "-P") + (warn! "The installed grep binary was not built with support for PCRE lookaheads") + (explain! "Some advanced consult filtering features will not work as a result, see the module readme.")) + (error! "Neither grep nor ripgrep are available on this system") + (explain! "Various file and project search features won't be available"))))