branch: externals/consult commit a07ca383318cdce6935a370f1d17687ba9f225c3 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Simpler fix for #420 --- consult.el | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/consult.el b/consult.el index 670e8a0..755ac74 100644 --- a/consult.el +++ b/consult.el @@ -537,9 +537,8 @@ ARGS is a list of commands or sources followed by the list of keyword-value pair (let ((opts (when (string-match " +--\\( +\\|\\'\\)" str) (prog1 (substring str (match-end 0)) (setq str (substring str 0 (match-beginning 0))))))) - (unless (string-blank-p str) - ;; split-string-and-unquote fails if the quotes are invalid. Ignore it. - (cons str (and opts (ignore-errors (split-string-and-unquote opts)))))))) + ;; split-string-and-unquote fails if the quotes are invalid. Ignore it. + (cons str (and opts (ignore-errors (split-string-and-unquote opts))))))) (defun consult--highlight-regexps (regexps str) "Highlight REGEXPS in STR. @@ -4178,7 +4177,7 @@ INITIAL is inital input." (pcase-let* ((cmd (split-string-and-unquote consult-grep-args)) (type (consult--grep-regexp-type (car cmd))) (`(,arg . ,opts) (consult--command-split input)) - (`(,re . ,hl) (and arg (funcall consult--regexp-compiler arg type)))) + (`(,re . ,hl) (funcall consult--regexp-compiler arg type))) (when re (list :command (append cmd @@ -4214,7 +4213,7 @@ Otherwise the `default-directory' is searched." (defun consult--git-grep-builder (input) "Build command line given CONFIG and INPUT." (pcase-let* ((`(,arg . ,opts) (consult--command-split input)) - (`(,re . ,hl) (and arg (funcall consult--regexp-compiler arg 'extended)))) + (`(,re . ,hl) (funcall consult--regexp-compiler arg 'extended))) (when re (list :command (append (split-string-and-unquote consult-git-grep-args) @@ -4244,7 +4243,7 @@ See `consult-grep' for more details." (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) (and arg (funcall consult--regexp-compiler arg type)))) + (`(,re . ,hl) (funcall consult--regexp-compiler arg type))) (when re (list :command (append cmd @@ -4301,7 +4300,7 @@ INITIAL is inital input." (pcase-let* ((cmd (split-string-and-unquote consult-find-args)) (type (consult--find-regexp-type (car cmd))) (`(,arg . ,opts) (consult--command-split input)) - (`(,re . ,hl) (and arg (funcall consult--regexp-compiler arg type)))) + (`(,re . ,hl) (funcall consult--regexp-compiler arg type))) (when re (list :command (append cmd @@ -4333,7 +4332,7 @@ See `consult-grep' for more details regarding the asynchronous search." (defun consult--locate-builder (input) "Build command line given INPUT." (pcase-let* ((`(,arg . ,opts) (consult--command-split input)) - (`(,re . ,hl) (and arg (funcall consult--regexp-compiler arg 'basic)))) + (`(,re . ,hl) (funcall consult--regexp-compiler arg 'basic))) (when re (list :command (append (split-string-and-unquote consult-locate-args) @@ -4355,10 +4354,10 @@ See `consult-grep' for more details regarding the asynchronous search." (defun consult--man-builder (input) "Build command line given CONFIG and INPUT." (pcase-let ((`(,arg . ,opts) (consult--command-split input))) - (and arg (not (string-blank-p arg)) - (list :command (append (split-string-and-unquote consult-man-args) - (list arg) opts) - :highlight (cdr (consult--default-regexp-compiler input 'basic)))))) + (unless (string-blank-p arg) + (list :command (append (split-string-and-unquote consult-man-args) + (list arg) opts) + :highlight (cdr (consult--default-regexp-compiler input 'basic)))))) (defun consult--man-format (lines) "Format man candidates from LINES."