[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/consult 9ea0de7 2/2: Revert "consult--split-style-perl:
From: |
ELPA Syncer |
Subject: |
[elpa] externals/consult 9ea0de7 2/2: Revert "consult--split-style-perl: Don't split if the first character is a space" |
Date: |
Thu, 5 Aug 2021 22:57:08 -0400 (EDT) |
branch: externals/consult
commit 9ea0de71da00430c3c6144919efd32fdfbd21cd7
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Revert "consult--split-style-perl: Don't split if the first character is a
space"
This reverts commit 030b7719fdfb14a718f1c7f21fc330c409a73111.
---
README.org | 4 +---
consult.el | 31 +++++++++++++------------------
2 files changed, 14 insertions(+), 21 deletions(-)
diff --git a/README.org b/README.org
index 218c9d1..97d93f6 100644
--- a/README.org
+++ b/README.org
@@ -531,8 +531,7 @@ their descriptions.
used for filtering.
The =perl= splitting style splits the input string at a punctuation character,
- using a similar syntax as Perl regular expressions. If the first character is
- a space, the space is ignored and the remaining string is not split.
+ using a similar syntax as Perl regular expressions.
Examples:
@@ -545,7 +544,6 @@ their descriptions.
- =#to#=: Force searching for "to" using grep, since the grep pattern
must be longer than =consult-async-min-input= characters by default.
- =#defun -- --invert-match#=: Pass argument =--invert-match= to grep.
- - =_+consult=: Search for "+consult". Note the space in the beginning!
Asynchronous processes like =find= and =grep= create an error log buffer
=_*consult-async*= (note the leading space), which is useful for
diff --git a/consult.el b/consult.el
index 2c0459a..ecc1a72 100644
--- a/consult.el
+++ b/consult.el
@@ -1345,24 +1345,19 @@ The function returns a list with four elements: The
async string, the
completion filter string, the new point position computed from POINT and a
force flag. If the first character is a punctuation character it determines the
separator. Examples: \"/async/filter\", \"#async#filter\"."
- (cond
- ;; If first character is a punctuation character, perform splitting.
- ((string-match-p "^[[:punct:]]" str)
- (save-match-data
- (let ((q (regexp-quote (substring str 0 1))))
- (string-match (concat "^" q "\\([^" q "]*\\)\\(" q "\\)?") str)
- `(,(match-string 1 str)
- ,(substring str (match-end 0))
- ,(max 0 (- point (match-end 0)))
- ;; Force update it two punctuation characters are entered.
- ,(match-end 2)
- ;; List of highlights
- (0 . ,(match-beginning 1))
- ,@(and (match-end 2) `((,(match-beginning 2) . ,(match-end 2))))))))
- ;; If first character is a space, ignore it!
- ((string-prefix-p " " str) `(,(substring str 1) "" 0))
- ;; Otherwise the whole string is to be treated as async input.
- (t `(,str "" 0))))
+ (if (string-match-p "^[[:punct:]]" str)
+ (save-match-data
+ (let ((q (regexp-quote (substring str 0 1))))
+ (string-match (concat "^" q "\\([^" q "]*\\)\\(" q "\\)?") str)
+ `(,(match-string 1 str)
+ ,(substring str (match-end 0))
+ ,(max 0 (- point (match-end 0)))
+ ;; Force update it two punctuation characters are entered.
+ ,(match-end 2)
+ ;; List of highlights
+ (0 . ,(match-beginning 1))
+ ,@(and (match-end 2) `((,(match-beginning 2) . ,(match-end 2)))))))
+ `(,str "" 0)))
(defun consult--split-separator (sep str point)
"Split input STR in async input and filtering part at the first separator
SEP.