emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/consult 05a0ee5 1/3: consult--join-regexps: No fallback


From: ELPA Syncer
Subject: [elpa] externals/consult 05a0ee5 1/3: consult--join-regexps: No fallback to ordered regular expressions, ignore excess input
Date: Mon, 9 Aug 2021 16:57:07 -0400 (EDT)

branch: externals/consult
commit 05a0ee5633d4a6e176a4c4dca0e385559bbeaf3f
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    consult--join-regexps: No fallback to ordered regular expressions, ignore 
excess input
    
    See #393
---
 consult.el | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/consult.el b/consult.el
index 88160c0..a82b2e6 100644
--- a/consult.el
+++ b/consult.el
@@ -619,16 +619,15 @@ 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
-  (cond
-   ((and (eq type 'pcre) (cdr regexps))
+  (if (and (eq type 'pcre) (cdr regexps))
     (concat "^" (mapconcat (lambda (x) (format "(?=.*%s)" x))
-                           regexps "")))
-   ((> (length regexps) 3)
-    (message "Too many regular expressions. Disengaging unordered matching. 
Use post-filtering!")
-    (string-join regexps ".*"))
-   (t
+                           regexps ""))
+    (when (> (length regexps) 3)
+      (message "Too many regular expressions, %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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]