branch: externals/consult commit 450d0c6592756f72c024dfd2290da65b22df4217 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
consult--join-regexps: Handle basic style --- consult.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/consult.el b/consult.el index 3194257..c1bf880 100644 --- a/consult.el +++ b/consult.el @@ -617,15 +617,19 @@ expression, which can be `basic', `extended', `emacs' or `pcre'." (defun consult--join-regexps (regexps type) "Join REGEXPS of TYPE." ;; Add lookahead wrapper only if there is more than one regular expression - (if (and (eq type 'pcre) (cdr regexps)) + (cond + ((and (eq type 'pcre) (cdr regexps)) (concat "^" (mapconcat (lambda (x) (format "(?=.*%s)" x)) - regexps "")) + regexps ""))) + ((eq type 'basic) + (string-join regexps ".*")) + (t (when (> (length regexps) 3) (message "Too many regexps, %S ignored. Use post-filtering!" (string-join (seq-drop regexps 3) " ")) (setq regexps (seq-take regexps 3))) (consult--regexp-join-permutations regexps - (and (memq type '(basic emacs)) "\\")))) + (and (memq type '(basic emacs)) "\\"))))) (defun consult--regexp-join-permutations (regexps esc) "Join all permutations of REGEXPS.