From 7a81b0252f9a18be767c6f95638f48820c0b07ee Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 20 Sep 2022 01:49:07 +0200 Subject: [PATCH] fix(lib): doom/help-search-{load-path,loaded-files} And updates them to reflect upstream changes to the consult--grep API. Ref: c994e3ed5924 --- lisp/lib/help.el | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/lisp/lib/help.el b/lisp/lib/help.el index 121880f7b..fbc9d0360 100644 --- a/lisp/lib/help.el +++ b/lisp/lib/help.el @@ -700,17 +700,28 @@ config blocks in your private config." prompt (lambda (input) (pcase-let* ((cmd (split-string-and-unquote consult-ripgrep-args)) - (type (consult--ripgrep-regexp-type (car cmd))) - (`(,arg . ,opts) (consult--command-split input)) - (`(,re . ,hl) (funcall consult--regexp-compiler arg type))) - (when re - (list :command - (append cmd - (and (eq type 'pcre) '("-P")) - (list "-e" (consult--join-regexps re type)) - opts - dirs) - :highlight hl)))) + (`(,arg . ,opts) (consult--command-split query)) + (flags (append cmd opts)) + (ignore-case (if (or (member "-S" flags) (member "--smart-case" flags)) + (let (case-fold-search) + ;; Case insensitive if there are no uppercase letters + (not (string-match-p "[[:upper:]]" arg))) + (or (member "-i" flags) (member "--ignore-case" flags))))) + (if (or (member "-F" flags) (member "--fixed-strings" flags)) + `(:command (,@cmd "-e" ,arg ,@opts ,@dirs) :highlight + ,(apply-partially #'consult--highlight-regexps + (list (regexp-quote arg)) ignore-case)) + (pcase-let* ((type (or consult--ripgrep-regexp-type + (setq consult--ripgrep-regexp-type + (if (consult--grep-lookahead-p (car cmd) "-P") 'pcre 'extended)))) + (`(,re . ,hl) (funcall consult--regexp-compiler arg type ignore-case))) + (when re + `(:command + (,@cmd ,@(and (eq type 'pcre) '("-P")) + "-e" ,(consult--join-regexps re type) + ,@opts + ,@dirs) + :highlight ,hl)))))) data-directory query)) ((fboundp 'counsel-rg) (let ((counsel-rg-base-command