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

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

[elpa] externals/consult bf598c8 5/5: Always treat \` and \' as ^ and $


From: ELPA Syncer
Subject: [elpa] externals/consult bf598c8 5/5: Always treat \` and \' as ^ and $ respectively
Date: Thu, 5 Aug 2021 15:57:10 -0400 (EDT)

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

    Always treat \` and \' as ^ and $ respectively
---
 consult.el | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/consult.el b/consult.el
index 904c8c3..2940e57 100644
--- a/consult.el
+++ b/consult.el
@@ -562,12 +562,14 @@ This function only changes the escaping of parentheses, 
braces and pipes."
     (let ((swap '(("\\|" . "|")
                     ("\\(" . "(") ("\\)" . ")")
                     ("\\{" . "{") ("\\}" . "}")))
-          (subst (if (memq type '(pcre rust))
-                     ;; \z matches at the end, \Z matches at the end and 
before the last \n
-                     '(("\\`" . "\\A") ("\\'" . "\\z")
-                       ("\\<" . "\\b") ("\\>" . "\\b")
-                       ("\\_<" . "\\b") ("\\_>" . "\\b"))
-                   '(("\\_<" . "\\<") ("\\_>" . "\\>")))))
+          (subst (append
+                  ;; Treat \` and \' as beginning and end of line. This is more
+                  ;; widely supported and makes sense for line-based commands.
+                  '(("\\`" . "^") ("\\'" . "$"))
+                  (if (memq type '(pcre rust))
+                      '(("\\<" . "\\b") ("\\>" . "\\b")
+                        ("\\_<" . "\\b") ("\\_>" . "\\b"))
+                    '(("\\_<" . "\\<") ("\\_>" . "\\>"))))))
       (replace-regexp-in-string
        "\\\\\\\\\\|\\\\?[(){}|]\\|\\\\[`'<>]\\|\\\\_[<>]"
        (lambda (x)
@@ -4069,7 +4071,7 @@ INITIAL is inital input."
   (with-temp-buffer
     (insert "xaxbx")
     (eq 0 (apply #'call-process-region (point-min) (point-max)
-                 (car cmd) nil nil nil `(,@cmd "^(?=.*b)(?=.*a)")))))
+                 (car cmd) nil nil nil `(,@(cdr cmd) "^(?=.*b)(?=.*a)")))))
 
 (defvar consult--grep-regexp-type nil)
 (defun consult--grep-regexp-type ()



reply via email to

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