fix(lib): consult case of doom--help-search
advise consult--ripgrep-make-builder instead of reimplementing
This commit is contained in:
parent
32599972ff
commit
54c4340740
1 changed files with 4 additions and 24 deletions
|
@ -699,29 +699,10 @@ config blocks in your private config."
|
||||||
(consult--grep
|
(consult--grep
|
||||||
prompt
|
prompt
|
||||||
(lambda (input)
|
(lambda (input)
|
||||||
(pcase-let* ((cmd (split-string-and-unquote consult-ripgrep-args))
|
;; PERF: avoid converting dirs to string and back when adding them to ripgrep args.
|
||||||
(`(,arg . ,opts) (consult--command-split query))
|
(letf! (defun consult--command-split (fn &rest args)
|
||||||
(flags (append cmd opts))
|
(append (apply consult--command-split args) dirs))
|
||||||
(ignore-case (if (or (member "-S" flags) (member "--smart-case" flags))
|
(funcall (consult--ripgrep-make-builder) input)))
|
||||||
(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))
|
data-directory query))
|
||||||
((fboundp 'counsel-rg)
|
((fboundp 'counsel-rg)
|
||||||
(let ((counsel-rg-base-command
|
(let ((counsel-rg-base-command
|
||||||
|
@ -760,4 +741,3 @@ Uses the symbol at point or the current selection, if available."
|
||||||
(format "%s.el" filebase)))
|
(format "%s.el" filebase)))
|
||||||
collect it)
|
collect it)
|
||||||
query "Search loaded files: "))
|
query "Search loaded files: "))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue