[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/urgrep 6f50ef99d3 032/115: Remove urgrep--to-command
|
From: |
ELPA Syncer |
|
Subject: |
[elpa] externals/urgrep 6f50ef99d3 032/115: Remove urgrep--to-command |
|
Date: |
Wed, 10 May 2023 03:00:40 -0400 (EDT) |
branch: externals/urgrep
commit 6f50ef99d3b1a398c84eb34bcca12905e757de1e
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Jim Porter <jporterbugs@gmail.com>
Remove urgrep--to-command
---
urgrep-tests.el | 41 +++++++++++++++++++++++------------------
urgrep.el | 29 +++++++++++++----------------
2 files changed, 36 insertions(+), 34 deletions(-)
diff --git a/urgrep-tests.el b/urgrep-tests.el
index 72666e5260..e5242cd54a 100644
--- a/urgrep-tests.el
+++ b/urgrep-tests.el
@@ -51,11 +51,11 @@
(should (equal (urgrep-command "foo" :tool tool :group nil)
(concat common-args "--no-heading -i -F -- foo")))
;; Regexp
- (should (equal (urgrep-command "(foo)" :tool tool :regexp-syntax 'bre)
+ (should (equal (urgrep-command "(foo)" :tool tool :regexp 'bre)
(concat common-args "--heading -i -- \\\\\\(foo\\\\\\)")))
- (should (equal (urgrep-command "(foo)" :tool tool :regexp-syntax 'ere)
+ (should (equal (urgrep-command "(foo)" :tool tool :regexp 'ere)
(concat common-args "--heading -i -- \\(foo\\)")))
- (should (equal (urgrep-command "(foo)" :tool tool :regexp-syntax 'pcre)
+ (should (equal (urgrep-command "(foo)" :tool tool :regexp 'pcre)
(concat common-args "--heading -i -- \\(foo\\)")))
;; Context
(should (equal (urgrep-command "foo" :tool tool :context 3)
@@ -88,11 +88,13 @@
(should (equal (urgrep-command "foo" :tool tool :group nil)
(concat common-args "--nogroup -i -Q -- foo")))
;; Regexp
- (should (equal (urgrep-command "(foo)" :tool tool :regexp-syntax 'bre)
+ (should (equal (urgrep-command "(foo)" :tool tool :regexp t)
(concat common-args "--group -i -- \\\\\\(foo\\\\\\)")))
- (should (equal (urgrep-command "(foo)" :tool tool :regexp-syntax 'ere)
+ (should (equal (urgrep-command "(foo)" :tool tool :regexp 'bre)
+ (concat common-args "--group -i -- \\\\\\(foo\\\\\\)")))
+ (should (equal (urgrep-command "(foo)" :tool tool :regexp 'ere)
(concat common-args "--group -i -- \\(foo\\)")))
- (should (equal (urgrep-command "(foo)" :tool tool :regexp-syntax 'pcre)
+ (should (equal (urgrep-command "(foo)" :tool tool :regexp 'pcre)
(concat common-args "--group -i -- \\(foo\\)")))
;; Context
(should (equal (urgrep-command "foo" :tool tool :context 3)
@@ -125,11 +127,13 @@
(should (equal (urgrep-command "foo" :tool tool :group nil)
(concat common-args "--nogroup -i -Q -- foo")))
;; Regexp
- (should (equal (urgrep-command "(foo)" :tool tool :regexp-syntax 'bre)
+ (should (equal (urgrep-command "(foo)" :tool tool :regexp t)
+ (concat common-args "--group -i -- \\\\\\(foo\\\\\\)")))
+ (should (equal (urgrep-command "(foo)" :tool tool :regexp 'bre)
(concat common-args "--group -i -- \\\\\\(foo\\\\\\)")))
- (should (equal (urgrep-command "(foo)" :tool tool :regexp-syntax 'ere)
+ (should (equal (urgrep-command "(foo)" :tool tool :regexp 'ere)
(concat common-args "--group -i -- \\(foo\\)")))
- (should (equal (urgrep-command "(foo)" :tool tool :regexp-syntax 'pcre)
+ (should (equal (urgrep-command "(foo)" :tool tool :regexp 'pcre)
(concat common-args "--group -i -- \\(foo\\)")))
;; Context
(should (equal (urgrep-command "foo" :tool tool :context 3)
@@ -162,11 +166,13 @@
(should (equal (urgrep-command "foo" :tool tool :group nil)
(concat common-args "-i -F -e foo")))
;; Regexp
- (should (equal (urgrep-command "(foo)" :tool tool :regexp-syntax 'bre)
+ (should (equal (urgrep-command "(foo)" :tool tool :regexp t)
(concat common-args "--heading --break -i -G -e
\\(foo\\)")))
- (should (equal (urgrep-command "(foo)" :tool tool :regexp-syntax 'ere)
+ (should (equal (urgrep-command "(foo)" :tool tool :regexp 'bre)
+ (concat common-args "--heading --break -i -G -e
\\(foo\\)")))
+ (should (equal (urgrep-command "(foo)" :tool tool :regexp 'ere)
(concat common-args "--heading --break -i -E -e
\\(foo\\)")))
- (should (equal (urgrep-command "(foo)" :tool tool :regexp-syntax 'pcre)
+ (should (equal (urgrep-command "(foo)" :tool tool :regexp 'pcre)
(concat common-args "--heading --break -i -P -e
\\(foo\\)")))
;; Context
(should (equal (urgrep-command "foo" :tool tool :context 3)
@@ -199,14 +205,13 @@
(urgrep-command "foo" :tool tool :group nil)))
;; Regexp
(should (string-match "^find \\. .*grep -G .*-i .*\\\\(foo\\\\)"
- (urgrep-command "(foo)" :tool tool
- :regexp-syntax 'bre)))
+ (urgrep-command "(foo)" :tool tool :regexp t)))
+ (should (string-match "^find \\. .*grep -G .*-i .*\\\\(foo\\\\)"
+ (urgrep-command "(foo)" :tool tool :regexp 'bre)))
(should (string-match "^find \\. .*grep -E .*-i .*\\\\(foo\\\\)"
- (urgrep-command "(foo)" :tool tool
- :regexp-syntax 'ere)))
+ (urgrep-command "(foo)" :tool tool :regexp 'ere)))
(should (string-match "^find \\. .*grep -P .*-i .*\\\\(foo\\\\)"
- (urgrep-command "(foo)" :tool tool
- :regexp-syntax 'pcre)))
+ (urgrep-command "(foo)" :tool tool :regexp 'pcre)))
;; Context
(should (string-match "^find \\. .*grep -F -C3 .*-i .*foo"
(urgrep-command "foo" :tool tool :context 3)))
diff --git a/urgrep.el b/urgrep.el
index 5601be6621..13b2590344 100644
--- a/urgrep.el
+++ b/urgrep.el
@@ -93,12 +93,12 @@ If a cons, show CAR and CDR lines before and after,
respectively."
;; Urgrep tools
-(cl-defun urgrep--rgrep-command (query &key tool regexp-syntax context
+(cl-defun urgrep--rgrep-command (query &key tool regexp context
&allow-other-keys)
(grep-compute-defaults)
;; Locally add options to `grep-find-template' that grep.el isn't aware of.
(let ((grep-find-template grep-find-template))
- (dolist (i `((regexp-arguments . ,regexp-syntax)
+ (dolist (i `((regexp-arguments . ,regexp)
(context-arguments . ,context)))
(when-let ((args (urgrep-get-property-pcase tool (car i) (cdr i)))
(args (mapconcat #'urgrep--maybe-shell-quote-argument args
@@ -273,9 +273,10 @@ for MS shells."
(xref--regexp-to-extended expr))
(t expr)))
-(cl-defun urgrep-command (query &rest rest &key tool (group t) regexp-syntax
+(cl-defun urgrep-command (query &rest rest &key tool (group t) regexp
(case-fold 'inherit) (context 0))
- (let* ((tool (urgrep-get-tool tool))
+ (let* ((regexp-syntax (if (eq regexp t) urgrep-regexp-syntax regexp))
+ (tool (urgrep-get-tool tool))
(tool-re-syntax (urgrep--get-best-syntax regexp-syntax tool))
(query (urgrep--convert-regexp query regexp-syntax tool-re-syntax))
(cmd-fun (urgrep-get-property tool 'command-function)))
@@ -286,7 +287,8 @@ for MS shells."
(setq case-fold (isearch-no-upper-case-p query regexp-syntax)))
;; Build the command arguments.
(if cmd-fun
- (apply cmd-fun query :tool tool :case-fold case-fold rest)
+ (apply cmd-fun query :tool tool :regexp regexp-syntax
+ :case-fold case-fold rest)
(let* ((executable (urgrep-get-property tool 'executable-name))
(pre-args (urgrep-get-property tool 'pre-arguments))
(arguments (urgrep-get-property tool 'post-arguments)))
@@ -326,7 +328,7 @@ If EDIT-COMMAND is non-nil, the search can be edited."
(apply #'urgrep--read-query urgrep-last-query))
(t (urgrep--read-command urgrep-last-query))))
(command (if (listp query)
- (apply #'urgrep--to-command query)
+ (apply #'urgrep-command query)
query)))
(with-current-buffer (compilation-start command 'urgrep-mode)
(setq urgrep-last-query query))))
@@ -670,7 +672,8 @@ future searches."
(define-key map "\M-sA" #'urgrep-set-after-context)
map))
-(cl-defun urgrep--read-query (initial &key (regexp urgrep-search-regexp)
+(cl-defun urgrep--read-query (initial &key (group urgrep-group-matches)
+ (regexp urgrep-search-regexp)
(case-fold urgrep-case-fold)
(context urgrep-context-lines))
"Prompt the user for a search query.
@@ -686,8 +689,8 @@ command."
(read-from-minibuffer prompt initial urgrep-minibuffer-map
nil
'urgrep-search-history default)))
(query (if (equal query "") default query)))
- (list query :regexp urgrep-search-regexp :case-fold urgrep-case-fold
- :context urgrep-context-lines)))
+ (list query :group group :regexp urgrep-search-regexp
+ :case-fold urgrep-case-fold :context urgrep-context-lines)))
(defun urgrep--read-command (command)
"Read a shell command to use for searching, with initial value COMMAND."
@@ -696,12 +699,6 @@ command."
'(urgrep-command-history . 1)
'urgrep-command-history)))
-(cl-defun urgrep--to-command (query &key regexp case-fold context)
- "Convert the result of `urgrep--read-query' to a shell command."
- (urgrep-command query :group urgrep-group-matches
- :regexp-syntax (and regexp urgrep-regexp-syntax)
- :case-fold case-fold :context context))
-
;; User-facing functions (and supporting helpers)
@@ -742,7 +739,7 @@ Type \\[urgrep-set-after-context] to set the number of
after context lines."
;; keyword arguments.
(urgrep--read-query nil)
(urgrep--read-directory current-prefix-arg)))
- (let ((command (cond ((listp query) (apply #'urgrep--to-command query))
+ (let ((command (cond ((listp query) (apply #'urgrep-command query))
(commandp query)
(t (apply #'urgrep-command query rest))))
(default-directory (or directory default-directory)))
- [elpa] externals/urgrep 7fd67f1db5 092/115: Run CI against Emacs 28.2, (continued)
- [elpa] externals/urgrep 7fd67f1db5 092/115: Run CI against Emacs 28.2, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 2ef7daa448 093/115: Reorganize tests a bit, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 500c01092d 086/115: Fix display override for null character in context lines, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 229ae0bfb5 110/115: Use a version identifier compatible with 'version-to-string', ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 6aefc895bc 113/115: Set system-type to gnu/linux when making the Urgrep command for Eshell, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 83e62357da 018/115: Provide a friendly default value when searching, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 98e20f0630 021/115: Use pcase macros for filling in optional arguments, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep bf24dac2ac 025/115: Allow for separate before/after contexts, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep f2ba643f35 028/115: Typo, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep c26ff9b22b 029/115: Add note about grep issues on MS Windows, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 6f50ef99d3 032/115: Remove urgrep--to-command,
ELPA Syncer <=
- [elpa] externals/urgrep 3599ad1a56 033/115: Update comment, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep ba2b01b91b 042/115: Remove no-longer-needed `post-arguments', ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 3643c933c4 055/115: Add support for ugrep, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 0de93bfdb9 068/115: Fix use of wgrep on long urgrep results, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep e2e8898ab2 074/115: Update copyright, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 0c966b2001 075/115: Ensure `default-directory' stays in sync, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep c15be33112 076/115: Wrap shell argument quoting with `with-connection-local-variables`, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep e63c6c5173 089/115: Add link to wgrep package and clarify the README, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 61478da305 077/115: Improve reliability of running urgrep over Tramp, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 77fcfc1916 090/115: Use `push` instead of `add-to-list`, ELPA Syncer, 2023/05/10