summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2024-03-12 20:11:38 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2024-03-12 20:12:58 +0100
commitd814ff6dbcb91c2540dc3b93908f0713d19d55f4 (patch)
tree472c3ac2bdfe3a0046258e8bb0d22e72e9cfd854
parented16a8e05922e39f0e57d188c288592a053d7c11 (diff)
orderless--literal-prefix-p: Pass START=2 to replace-regexp-in-string
-rw-r--r--orderless.el17
1 files changed, 8 insertions, 9 deletions
diff --git a/orderless.el b/orderless.el
index 9c7b6b4..4bab77b 100644
--- a/orderless.el
+++ b/orderless.el
@@ -497,15 +497,14 @@ The predicate PRED is used to constrain the entries in TABLE."
"Determine if REGEXP is a quoted regexp anchored at the beginning.
If REGEXP is of the form \"\\`q\" for q = (regexp-quote u),
then return (cons REGEXP u); else return nil."
- (when (string-prefix-p "\\`" regexp)
- (let ((trimmed (substring regexp 2)))
- (unless (string-match-p "[$*+.?[\\^]"
- (replace-regexp-in-string
- "\\\\[$*+.?[\\^]" "" trimmed
- 'fixedcase 'literal))
- (cons regexp
- (replace-regexp-in-string "\\\\\\([$*+.?[\\^]\\)" "\\1"
- trimmed 'fixedcase))))))
+ (when (and (string-prefix-p "\\`" regexp)
+ (not (string-match-p "[$*+.?[\\^]"
+ (replace-regexp-in-string
+ "\\\\[$*+.?[\\^]" "" regexp
+ 'fixedcase 'literal nil 2))))
+ (cons regexp
+ (replace-regexp-in-string "\\\\\\([$*+.?[\\^]\\)" "\\1"
+ regexp 'fixedcase nil nil 2))))
(defun orderless--ignore-case-p (regexps)
"Return non-nil if case should be ignored for REGEXPS."