[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/consult 652938f 3/6: Introduce consult-regexp-function
From: |
ELPA Syncer |
Subject: |
[elpa] externals/consult 652938f 3/6: Introduce consult-regexp-function |
Date: |
Tue, 3 Aug 2021 14:57:12 -0400 (EDT) |
branch: externals/consult
commit 652938f39edca6585cb33effe2d0725c7c382f73
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Introduce consult-regexp-function
---
README.org | 1 +
consult.el | 24 ++++++++++++++++++++----
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/README.org b/README.org
index 078b8ad..a2ffc5b 100644
--- a/README.org
+++ b/README.org
@@ -935,6 +935,7 @@ configuration examples.
| consult-preview-max-size | 10485760 | Files larger than
this size are not previewed |
| consult-preview-raw-size | 102400 | Files larger than
this size are previewed in raw form |
| consult-project-root-function | nil | Function which
returns current project root |
+ | consult-regexp-function | ... | Convert string to
regular expression |
| consult-register-narrow | ... | Narrowing
configuration for =consult-register= |
| consult-ripgrep-command | "rg ..." | Command line
arguments for ripgrep |
| consult-themes | nil | List of themes to be
presented for selection |
diff --git a/consult.el b/consult.el
index e1d7aed..34b18bd 100644
--- a/consult.el
+++ b/consult.el
@@ -220,7 +220,7 @@ See `consult--multi' for a description of the source
values."
(defcustom consult-git-grep-command
'("git --no-pager grep --null --color=always --extended-regexp"
"--line-number -I -e"
- (string-join (split-string arg nil t) ".*") opts)
+ (consult-regexp arg) opts)
"Command line arguments for git-grep, see `consult-git-grep'.
See `consult-ripgrep-command' for details on the configuration."
:type 'sexp)
@@ -228,7 +228,7 @@ See `consult-ripgrep-command' for details on the
configuration."
(defcustom consult-grep-command
'("grep --null --line-buffered --color=always --extended-regexp"
"--exclude-dir=.git --line-number -I -r . -e"
- (string-join (split-string arg nil t) ".*") opts)
+ (consult-regexp arg) opts)
"Command line arguments for grep, see `consult-grep'.
See `consult-ripgrep-command' for details on the configuration."
:type 'sexp)
@@ -240,7 +240,7 @@ See `consult-ripgrep-command' for details on the
configuration."
(defcustom consult-ripgrep-command
'("rg --null --line-buffered --color=ansi --max-columns=1000"
"--smart-case --no-heading --line-number . -e"
- (string-join (split-string arg nil t) ".*") opts)
+ (consult-regexp arg) opts)
"Command line arguments for ripgrep, see `consult-ripgrep'.
The command line arguments must be specified as a list of strings and
@@ -258,7 +258,7 @@ See `consult-ripgrep-command' for details on the
configuration."
(defcustom consult-locate-command
'("locate --ignore-case --existing --regexp"
- (string-join (split-string arg nil t) ".*") opts)
+ (consult-regexp arg) opts)
"Command line arguments for locate, see `consult-locate'.
See `consult-ripgrep-command' for details on the configuration."
:type 'sexp)
@@ -269,6 +269,14 @@ See `consult-ripgrep-command' for details on the
configuration."
See `consult-ripgrep-command' for details on the configuration."
:type 'sexp)
+(defcustom consult-regexp-function
+ #'consult-spaced-regexp
+ "Function which transforms a string to a regular expression.
+The default value "
+ :type '(choice (const :tag "Space separated" consult-spaced-regexp)
+ (const :tag "No transformation" identity)
+ (function :tag "Custom function")))
+
(defcustom consult-preview-key 'any
"Preview trigger keys, can be nil, 'any, a single key or a list of keys."
:type '(choice (const :tag "Any key" any)
@@ -526,6 +534,14 @@ ARGS is a list of commands or sources followed by the list
of keyword-value pair
;;;; Helper functions and macros
+(defun consult-spaced-regexp (str)
+ "Convert string STR to a regular expression, replace spaces by `.*'."
+ (string-join (split-string str nil t) ".*"))
+
+(defun consult-regexp (str)
+ "Convert string STR to a regular expression, call `consult-regexp-function'."
+ (funcall consult-regexp-function str))
+
(defmacro consult--keep! (list form)
"Evaluate FORM for every element of LIST and keep the non-nil results."
(declare (indent 1))
- [elpa] externals/consult updated (e3418a9 -> bdffe37), ELPA Syncer, 2021/08/03
- [elpa] externals/consult e0bd3c0 1/6: Add consult--to-list, ELPA Syncer, 2021/08/03
- [elpa] externals/consult 652938f 3/6: Introduce consult-regexp-function,
ELPA Syncer <=
- [elpa] externals/consult bdffe37 6/6: Update README, ELPA Syncer, 2021/08/03
- [elpa] externals/consult 46f6c7a 2/6: Generalize command line arguments, ELPA Syncer, 2021/08/03
- [elpa] externals/consult cfbe798 5/6: Update docstring, ELPA Syncer, 2021/08/03
- [elpa] externals/consult e76b088 4/6: Update changelog, ELPA Syncer, 2021/08/03