[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 27add46 092/399: Anchor pcre lookaround patterns to bol
From: |
Oleh Krehel |
Subject: |
[elpa] master 27add46 092/399: Anchor pcre lookaround patterns to bol |
Date: |
Sat, 20 Jul 2019 14:56:55 -0400 (EDT) |
branch: master
commit 27add462e3d05961f5681e6dc09e39235362ff39
Author: CeleritasCelery <address@hidden>
Commit: Oleh Krehel <address@hidden>
Anchor pcre lookaround patterns to bol
Fixes #1976
Fixes #1979
---
counsel.el | 20 +++++++++++---------
ivy-test.el | 4 ++--
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/counsel.el b/counsel.el
index fae7531..6aa0cba 100644
--- a/counsel.el
+++ b/counsel.el
@@ -63,14 +63,16 @@ Note that incorrect results may be returned for sufficiently
complex regexes."
(if (consp regex)
(if look-around
- (mapconcat
- (lambda (pair)
- (let ((subexp (counsel--elisp-to-pcre (car pair))))
- (format "(?%c.*%s)"
- (if (cdr pair) ?= ?!)
- subexp)))
- regex
- "")
+ (concat
+ "^"
+ (mapconcat
+ (lambda (pair)
+ (let ((subexp (counsel--elisp-to-pcre (car pair))))
+ (format "(?%c.*%s)"
+ (if (cdr pair) ?= ?!)
+ subexp)))
+ regex
+ ""))
(mapconcat
(lambda (pair)
(let ((subexp (counsel--elisp-to-pcre (car pair))))
@@ -2621,7 +2623,7 @@ NEEDLE is the search string."
(let ((default-directory (ivy-state-directory ivy-last))
(regex (counsel--grep-regex search-term)))
(if (and (stringp counsel--regex-look-around)
- (string-match-p "\\`(\\?[=!]" regex)) ;; using look-arounds
+ (string-match-p "\\`\\^(\\?[=!]" regex)) ;; using
look-arounds
(setq switches (concat switches " " counsel--regex-look-around)))
(counsel--async-command (counsel--format-ag-command
switches
diff --git a/ivy-test.el b/ivy-test.el
index 0099615..c224bc9 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -347,7 +347,7 @@ will bring the behavior in line with the newer Emacsen."
"(?:foo|bar).*blick.*(?:(baz)|quux)"))
(should (equal (counsel--elisp-to-pcre
'(("ivy" . t) ("-")) t)
- "(?=.*ivy)(?!.*-)")))
+ "^(?=.*ivy)(?!.*-)")))
(defmacro ivy--string-buffer (text &rest body)
"Test helper that wraps TEXT in a temp buffer while running BODY."
@@ -989,7 +989,7 @@ a buffer visiting a file."
(let ((counsel--regex-look-around t)
(ivy--regex-function 'ivy--regex-plus))
(counsel--grep-regex "ivy ! -"))
- "(?=.*ivy)(?!.*-)"))
+ "^(?=.*ivy)(?!.*-)"))
(should
(string=
(let ((counsel--regex-look-around t)
- [elpa] master db905cc 088/399: counsel.el (counsel-compile-phony-pattern): Use plain regex, (continued)
- [elpa] master db905cc 088/399: counsel.el (counsel-compile-phony-pattern): Use plain regex, Oleh Krehel, 2019/07/20
- [elpa] master 4e07e6f 048/399: ivy.el (ivy-make-magic-action): Add docstring to the generated lambda, Oleh Krehel, 2019/07/20
- [elpa] master 8a40934 062/399: counsel.el: Clean up compile candidates list, Oleh Krehel, 2019/07/20
- [elpa] master 0c30e3f 063/399: counsel.el: Minor compile history cleanup, Oleh Krehel, 2019/07/20
- [elpa] master 114ae96 070/399: counsel.el: Find project root more flexibly, Oleh Krehel, 2019/07/20
- [elpa] master 5aa263c 079/399: counsel.el (counsel-compile-make-pattern): Fix regex, Oleh Krehel, 2019/07/20
- [elpa] master cc50da2 080/399: counsel.el (counsel-dired-jump-args): Fix -type d, Oleh Krehel, 2019/07/20
- [elpa] master a473519 086/399: Fix error in ivy-make-magic-action, Oleh Krehel, 2019/07/20
- [elpa] master 9ce9e4e 090/399: counsel.el (counsel-compile-phony-pattern): Fixup, Oleh Krehel, 2019/07/20
- [elpa] master 1046fc7 095/399: ivy.el (ivy-avy): Use non-obsolete avy-process, Oleh Krehel, 2019/07/20
- [elpa] master 27add46 092/399: Anchor pcre lookaround patterns to bol,
Oleh Krehel <=
- [elpa] master 3e1e905 083/399: Fix virtual buffers in counsel-switch-buffer, Oleh Krehel, 2019/07/20
- [elpa] master cbdc9c9 078/399: counsel.el (counsel--compile-get-make-targets): Rename, Oleh Krehel, 2019/07/20
- [elpa] master e7146e5 089/399: counsel.el (counsel-git-grep-count-function): Fix, Oleh Krehel, 2019/07/20
- [elpa] master b180abf 087/399: counsel.el (counsel-compile): clean-up get-make-targets, Oleh Krehel, 2019/07/20
- [elpa] master 456e575 093/399: Don't bury killed buffers after counsel-switch-buffer, Oleh Krehel, 2019/07/20
- [elpa] master 1c84179 098/399: counsel.el (counsel-rg): Add an example to the doc, Oleh Krehel, 2019/07/20
- [elpa] master b154260 097/399: counsel.el (counsel-grep): Fix TRAMP problems, Oleh Krehel, 2019/07/20
- [elpa] master adab07d 101/399: counsel.el: Simplify counsel-git-grep, Oleh Krehel, 2019/07/20
- [elpa] master 5b4dbbc 096/399: ivy.el: Silence byte-compiler, Oleh Krehel, 2019/07/20
- [elpa] master 3954bfe 081/399: counsel.el (counsel-compile): Don't modify compilation-start-hook permanently, Oleh Krehel, 2019/07/20