[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/urgrep efef42bfc1: Fix ripgrep/ugrep on Windows; resolv
From: |
ELPA Syncer |
Subject: |
[elpa] externals/urgrep efef42bfc1: Fix ripgrep/ugrep on Windows; resolves #7 |
Date: |
Thu, 21 Dec 2023 21:58:45 -0500 (EST) |
branch: externals/urgrep
commit efef42bfc15a9acc85cf55da53538e65b1611d7d
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Jim Porter <jporterbugs@gmail.com>
Fix ripgrep/ugrep on Windows; resolves #7
This was broken because ripgrep/ugrep assume you're piping data in to
search if
stdin is a pipe. Since Emacs only uses pipes for child processes on Windows,
things get confused. The solution is to always pass the search directory to
ripgrep/ugrep, even when it's just ".".
---
NEWS.md | 7 +++++
urgrep-tests.el | 82 ++++++++++++++++++++++++++++++---------------------------
urgrep.el | 10 +++----
3 files changed, 54 insertions(+), 45 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index 3b25a9d07f..9c665f63a1 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,12 @@
# Urgrep News
+## v0.3.1 (in progress)
+
+### Bug fixes
+- Fix invocation of `ripgrep` and `urgrep` on Windows
+
+---
+
## v0.3.0 (2023-12-17)
### New features
diff --git a/urgrep-tests.el b/urgrep-tests.el
index 019a6e782a..782e662e6f 100644
--- a/urgrep-tests.el
+++ b/urgrep-tests.el
@@ -139,66 +139,68 @@ joined to compare against COMMAND."
(ert-info ("String/case")
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool)
- `(,@common-args "--heading" "--break" "-i" "-F" "-e" "foo"))
+ `(,@common-args "--heading" "--break" "-i" "-F" "-e" "foo" "."))
(urgrep-tests/check-command
(urgrep-command "Foo" :tool tool)
- `(,@common-args "--heading" "--break" "-F" "-e" "Foo"))
+ `(,@common-args "--heading" "--break" "-F" "-e" "Foo" "."))
(let ((case-fold-search nil))
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool)
- `(,@common-args "--heading" "--break" "-F" "-e" "foo")))
+ `(,@common-args "--heading" "--break" "-F" "-e" "foo" ".")))
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :case-fold t)
- `(,@common-args "--heading" "--break" "-i" "-F" "-e" "foo"))
+ `(,@common-args "--heading" "--break" "-i" "-F" "-e" "foo" "."))
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :case-fold nil)
- `(,@common-args "--heading" "--break" "-F" "-e" "foo"))
+ `(,@common-args "--heading" "--break" "-F" "-e" "foo" "."))
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :case-fold 'smart)
- `(,@common-args "--heading" "--break" "-i" "-F" "-e" "foo"))
+ `(,@common-args "--heading" "--break" "-i" "-F" "-e" "foo" "."))
(urgrep-tests/check-command
(urgrep-command "Foo" :tool tool :case-fold 'smart)
- `(,@common-args "--heading" "--break" "-F" "-e" "Foo")))
+ `(,@common-args "--heading" "--break" "-F" "-e" "Foo" ".")))
(ert-info ("Group")
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :group nil)
- `(,@common-args "-i" "-F" "-e" "foo")))
+ `(,@common-args "-i" "-F" "-e" "foo" ".")))
(ert-info ("Regexp")
(urgrep-tests/check-command
(urgrep-command "(foo)" :tool tool :regexp t)
- `(,@common-args "--heading" "--break" "-i" "-G" "-e" "(foo)"))
+ `(,@common-args "--heading" "--break" "-i" "-G" "-e" "(foo)" "."))
(urgrep-tests/check-command
(urgrep-command "(foo)" :tool tool :regexp 'bre)
- `(,@common-args "--heading" "--break" "-i" "-G" "-e" "(foo)"))
+ `(,@common-args "--heading" "--break" "-i" "-G" "-e" "(foo)" "."))
(urgrep-tests/check-command
(urgrep-command "(foo)" :tool tool :regexp 'ere)
- `(,@common-args "--heading" "--break" "-i" "-E" "-e" "(foo)"))
+ `(,@common-args "--heading" "--break" "-i" "-E" "-e" "(foo)" "."))
(urgrep-tests/check-command
(urgrep-command "(foo)" :tool tool :regexp 'pcre)
- `(,@common-args "--heading" "--break" "-i" "-P" "-e" "(foo)")))
+ `(,@common-args "--heading" "--break" "-i" "-P" "-e" "(foo)" ".")))
(ert-info ("Context")
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :context 3)
- `(,@common-args "--heading" "--break" "-C3" "-i" "-F" "-e" "foo"))
+ `(,@common-args "--heading" "--break" "-C3" "-i" "-F" "-e" "foo" "."))
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :context '(3 . 3))
- `(,@common-args "--heading" "--break" "-C3" "-i" "-F" "-e" "foo"))
+ `(,@common-args "--heading" "--break" "-C3" "-i" "-F" "-e" "foo" "."))
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :context '(2 . 4))
- `(,@common-args "--heading" "--break" "-B2" "-A4" "-i" "-F" "-e"
"foo")))
+ `(,@common-args "--heading" "--break" "-B2" "-A4" "-i" "-F" "-e" "foo"
+ ".")))
(ert-info ("Hidden files")
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :hidden t)
- `(,@common-args "--hidden" "--heading" "--break" "-i" "-F" "-e" "foo")))
+ `(,@common-args "--hidden" "--heading" "--break" "-i" "-F" "-e" "foo"
+ ".")))
(ert-info ("File wildcard")
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :file-wildcard "*.el")
`(,@common-args "--include=*.el" "--heading" "--break" "-i" "-F" "-e"
- "foo"))
+ "foo" "."))
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :file-wildcard '("*.c" "*.h"))
`(,@common-args "--include=*.c" "--include=*.h" "--heading" "--break"
- "-i" "-F" "-e" "foo")))
+ "-i" "-F" "-e" "foo" ".")))
(ert-info ("Root")
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :root "dir")
@@ -218,75 +220,77 @@ joined to compare against COMMAND."
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :color nil)
'("ugrep" "--color=never" "-rn" "--ignore-files" "--heading"
- "--break" "-i" "-F" "-e" "foo")))))
+ "--break" "-i" "-F" "-e" "foo" ".")))))
(ert-deftest urgrep-tests/command/ripgrep ()
(let ((tool (assq 'ripgrep urgrep-tools))
(common-args '("rg" "--color=always" "--colors=path:none"
"--colors=path:fg:magenta" "--colors=line:none"
"--colors=column:none" "--colors=match:none"
- "--colors=match:fg:red" "--colors=match:style:bold")))
+ "--colors=match:fg:red" "--colors=match:style:bold"
+ "-n")))
(ert-info ("String/case")
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool)
- `(,@common-args "--heading" "-i" "-F" "--" "foo"))
+ `(,@common-args "--heading" "-i" "-F" "--" "foo" "."))
(urgrep-tests/check-command
(urgrep-command "Foo" :tool tool)
- `(,@common-args "--heading" "-F" "--" "Foo"))
+ `(,@common-args "--heading" "-F" "--" "Foo" "."))
(let ((case-fold-search nil))
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool)
- `(,@common-args "--heading" "-F" "--" "foo")))
+ `(,@common-args "--heading" "-F" "--" "foo" ".")))
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :case-fold t)
- `(,@common-args "--heading" "-i" "-F" "--" "foo"))
+ `(,@common-args "--heading" "-i" "-F" "--" "foo" "."))
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :case-fold nil)
- `(,@common-args "--heading" "-F" "--" "foo"))
+ `(,@common-args "--heading" "-F" "--" "foo" "."))
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :case-fold 'smart)
- `(,@common-args "--heading" "-i" "-F" "--" "foo"))
+ `(,@common-args "--heading" "-i" "-F" "--" "foo" "."))
(urgrep-tests/check-command
(urgrep-command "Foo" :tool tool :case-fold 'smart)
- `(,@common-args "--heading" "-F" "--" "Foo")))
+ `(,@common-args "--heading" "-F" "--" "Foo" ".")))
(ert-info ("Group")
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :group nil)
- `(,@common-args "--no-heading" "-i" "-F" "--" "foo")))
+ `(,@common-args "--no-heading" "-i" "-F" "--" "foo" ".")))
(ert-info ("Regexp")
(urgrep-tests/check-command
(urgrep-command "(foo)" :tool tool :regexp t)
- `(,@common-args "--heading" "-i" "--" "\\(foo\\)"))
+ `(,@common-args "--heading" "-i" "--" "\\(foo\\)" "."))
(urgrep-tests/check-command
(urgrep-command "(foo)" :tool tool :regexp 'bre)
- `(,@common-args "--heading" "-i" "--" "\\(foo\\)"))
+ `(,@common-args "--heading" "-i" "--" "\\(foo\\)" "."))
(urgrep-tests/check-command
(urgrep-command "(foo)" :tool tool :regexp 'ere)
- `(,@common-args "--heading" "-i" "--" "(foo)"))
+ `(,@common-args "--heading" "-i" "--" "(foo)" "."))
(urgrep-tests/check-command
(urgrep-command "(foo)" :tool tool :regexp 'pcre)
- `(,@common-args "--heading" "-i" "--" "(foo)")))
+ `(,@common-args "--heading" "-i" "--" "(foo)" ".")))
(ert-info ("Context")
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :context 3)
- `(,@common-args "--heading" "-C3" "-i" "-F" "--" "foo"))
+ `(,@common-args "--heading" "-C3" "-i" "-F" "--" "foo" "."))
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :context '(3 . 3))
- `(,@common-args "--heading" "-C3" "-i" "-F" "--" "foo"))
+ `(,@common-args "--heading" "-C3" "-i" "-F" "--" "foo" "."))
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :context '(2 . 4))
- `(,@common-args "--heading" "-B2" "-A4" "-i" "-F" "--" "foo")))
+ `(,@common-args "--heading" "-B2" "-A4" "-i" "-F" "--" "foo" ".")))
(ert-info ("Hidden files")
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :hidden t)
- `(,@common-args "--hidden" "--heading" "-i" "-F" "--" "foo")))
+ `(,@common-args "--hidden" "--heading" "-i" "-F" "--" "foo" ".")))
(ert-info ("File wildcard")
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :file-wildcard "*.el")
- `(,@common-args "-g" "*.el" "--heading" "-i" "-F" "--" "foo"))
+ `(,@common-args "-g" "*.el" "--heading" "-i" "-F" "--" "foo" "."))
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :file-wildcard '("*.c" "*.h"))
- `(,@common-args "-g" "*.c" "-g" "*.h" "--heading" "-i" "-F" "--"
"foo")))
+ `(,@common-args "-g" "*.c" "-g" "*.h" "--heading" "-i" "-F" "--" "foo"
+ ".")))
(ert-info ("Root")
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :root "dir")
@@ -304,7 +308,7 @@ joined to compare against COMMAND."
(ert-info ("Color")
(urgrep-tests/check-command
(urgrep-command "foo" :tool tool :color nil)
- '("rg" "--color=never" "--heading" "-i" "-F" "--" "foo")))))
+ '("rg" "--color=never" "-n" "--heading" "-i" "-F" "--" "foo" ".")))))
(ert-deftest urgrep-tests/command/ag ()
(let ((tool (assq 'ag urgrep-tools))
diff --git a/urgrep.el b/urgrep.el
index 15b32c673e..56f8e75e8a 100644
--- a/urgrep.el
+++ b/urgrep.el
@@ -366,8 +366,7 @@ See also `grep-process-setup'."
(file-wildcard-arguments
((and x (pred identity))
(mapcar (lambda (i) (concat "--include=" i)) x)))
- (root-arguments ('(".") nil)
- (x x))
+ (root-arguments (x x))
(group-arguments ((pred identity) '("--heading" "--break")))
(context-arguments . ,urgrep--context-arguments)
(color-arguments
@@ -377,16 +376,15 @@ See also `grep-process-setup'."
(ripgrep
(executable-name . "rg")
(regexp-syntax pcre)
- (arguments executable (:abbreviate color) hidden-file file-wildcard group
- context case-fold regexp "--" query root)
+ (arguments executable (:abbreviate color "-n") hidden-file file-wildcard
+ group context case-fold regexp "--" query root)
(regexp-arguments ('nil '("-F")))
(case-fold-arguments ((pred identity) '("-i")))
(hidden-file-arguments ((pred identity) '("--hidden")))
(file-wildcard-arguments
((and x (pred identity))
(flatten-list (mapcar (lambda (i) (cons "-g" i)) x))))
- (root-arguments ('(".") nil)
- (x x))
+ (root-arguments (x x))
(group-arguments ('nil '("--no-heading"))
(_ '("--heading")))
(context-arguments . ,urgrep--context-arguments)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/urgrep efef42bfc1: Fix ripgrep/ugrep on Windows; resolves #7,
ELPA Syncer <=