From d814ff6dbcb91c2540dc3b93908f0713d19d55f4 Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Tue, 12 Mar 2024 20:11:38 +0100 Subject: orderless--literal-prefix-p: Pass START=2 to replace-regexp-in-string --- orderless.el | 17 ++++++++--------- 1 file 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." -- cgit v1.0