From d718b1f106d721ea393fd4b2af1ef2f08dd548f6 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 30 Aug 2021 22:18:13 -0500 Subject: Add `affe' --- init.el | 9 +++++++++ lisp/acdw-consult.el | 23 ++++++++++++++++------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/init.el b/init.el index 1948783..acdea0c 100644 --- a/init.el +++ b/init.el @@ -1044,6 +1044,15 @@ like a dumbass." (apheleia--get-formatter-command))) (indent-region (point-min) (point-max)))))) +(setup (:straight-if affe + (executable-find "rg")) + ;; Keys are bound in `acdw/sensible-grep' and `acdw/sensible-find' + (defun affe-orderless-regexp-compiler (input _type) + (setq input (orderless-pattern-compiler input)) + (cons input (lambda (str) (orderless--highlight input str)))) + + (:option affe-regexp-compiler #'affe-orderless-regexp-compiler)) + (setup (:straight async) (autoload 'dired-async-mode "dired-async.el" nil t) (dired-async-mode +1)) diff --git a/lisp/acdw-consult.el b/lisp/acdw-consult.el index e6995f5..58a2136 100644 --- a/lisp/acdw-consult.el +++ b/lisp/acdw-consult.el @@ -9,17 +9,26 @@ "Perform `consult-git-grep' if in a git project, otherwise `consult-ripgrep' if ripgrep is installed, otherwise `consult-grep'." (interactive "P") - (cond ((executable-find "rg") - (call-interactively #'consult-ripgrep)) - ((string-equal (vc-backend buffer-file-name) "Git") - (call-interactively #'consult-git-grep)) - (t (call-interactively #'consult-grep)))) + (call-interactively + (cond ((executable-find "rg") + (if (fboundp 'affe-grep) + #'affe-grep + #'consult-ripgrep)) + ((string-equal (vc-backend buffer-file-name) "Git") + #'consult-git-grep) + (t #'consult-grep)))) (defun acdw-consult/sensible-find (&optional arg) "Peform `consult-locate' if locate is installed, otehrwise `consult-find'." (interactive "P") - (cond ((executable-find "locate") (call-interactively #'consult-locate)) - (t (call-interactively #'consult-find)))) + (call-interactively + (cond ((executable-find "locate") + #'consult-locate) + ((fboundp 'affe-find) + (when (executable-find "fd") + (setq affe-find-command "fd -HI -t f")) + #'affe-find) + (t #'consult-find)))) ;; Orderless Regexp Compiler! -- from Consult Wiki (defun consult--orderless-regexp-compiler (input type) -- cgit 1.4.1-21-gabe81