branch: externals/urgrep commit 8c6e3d5ba2407cdef33a268ae5d539e7241bfc63 Author: Jim Porter <jporterb...@gmail.com> Commit: Jim Porter <jporterb...@gmail.com>
Ensure we get exactly the colors we want --- urgrep-tests.el | 24 ++++++++++++++++-------- urgrep.el | 31 ++++++++++++++++++++++--------- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/urgrep-tests.el b/urgrep-tests.el index 016b826f4c..6e4c58f90a 100644 --- a/urgrep-tests.el +++ b/urgrep-tests.el @@ -155,9 +155,10 @@ joined to compare against COMMAND." (ert-deftest urgrep-tests/command/ripgrep () (let ((tool (assq 'ripgrep urgrep-tools)) - (common-args '("rg" "--color" "always" "--colors" "path:fg:magenta" - "--colors" "match:fg:red" "--colors" - "match:style:bold"))) + (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"))) ;; String/case (urgrep-tests/check-command (urgrep-command "foo" :tool tool) @@ -219,11 +220,12 @@ joined to compare against COMMAND." ;; Color (urgrep-tests/check-command (urgrep-command "foo" :tool tool :color nil) - (append '("rg" "--color" "never" "--heading" "-i" "-F" "--" "foo"))))) + (append '("rg" "--color=never" "--heading" "-i" "-F" "--" "foo"))))) (ert-deftest urgrep-tests/command/ag () (let ((tool (assq 'ag urgrep-tools)) - (common-args '("ag" "--color-path" "35" "--color-match" "1;31"))) + (common-args '("ag" "--color" "--color-path=35" "--color-line=" + "--color-match=1;31"))) ;; String/case (urgrep-tests/check-command (urgrep-command "foo" :tool tool) @@ -290,8 +292,9 @@ joined to compare against COMMAND." (ert-deftest urgrep-tests/command/ack () (let ((tool (assq 'ack urgrep-tools)) - (common-args '("ack" "--color-filename" "magenta" "--color-match" - "bold red"))) + (common-args '("ack" "--color" "--color-filename=magenta" + "--color-lineno=clear" "--color-colno=clear" + "--color-match=bold red"))) ;; String/case (urgrep-tests/check-command (urgrep-command "foo" :tool tool) @@ -359,7 +362,12 @@ joined to compare against COMMAND." (ert-deftest urgrep-tests/command/git-grep () (let ((tool (assq 'git-grep urgrep-tools)) (common-args '("git" "--no-pager" "-c" "color.grep.filename=magenta" - "-c" "color.grep.match=bold red" "grep" "--color" + "-c" "color.grep.match=bold red" "-c" + "color.grep.context=" "-c" "color.grep.function=" + "-c" "color.grep.lineNumber=" "-c" "color.grep.column=" + "-c" "color.grep.matchContext=" "-c" + "color.grep.matchSelected=" "-c" "color.grep.selected=" + "-c" "color.grep.separator=" "grep" "--color" "--no-index" "--exclude-standard" "-n")) (group-args '("--heading" "--break"))) ;; String/case diff --git a/urgrep.el b/urgrep.el index a1f9bb7088..f8545af147 100644 --- a/urgrep.el +++ b/urgrep.el @@ -301,10 +301,12 @@ See also `grep-process-setup'." (group-arguments ('nil '("--no-heading")) (_ '("--heading"))) (context-arguments . ,urgrep--context-arguments) - (color-arguments ('nil '("--color" "never")) - (_ '("--color" "always" "--colors" "path:fg:magenta" - "--colors" "match:fg:red" "--colors" - "match:style:bold")))) + (color-arguments ('nil '("--color=never")) + (_ '("--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")))) (ag (executable-name . "ag") (regexp-syntax pcre) @@ -320,7 +322,8 @@ See also `grep-process-setup'." (_ '("--group"))) (context-arguments . ,urgrep--context-arguments) (color-arguments ('nil '("--nocolor")) - (_ '("--color-path" "35" "--color-match" "1;31")))) + (_ '("--color" "--color-path=35" "--color-line=" + "--color-match=1;31")))) (ack (executable-name . "ack") (regexp-syntax pcre) @@ -335,8 +338,9 @@ See also `grep-process-setup'." (_ '("--group"))) (context-arguments . ,urgrep--context-arguments) (color-arguments ('nil '("--nocolor")) - (_ '("--color-filename" "magenta" "--color-match" - "bold red")))) + (_ '("--color" "--color-filename=magenta" + "--color-lineno=clear" "--color-colno=clear" + "--color-match=bold red")))) (git-grep (executable-name . "git") ;; XXX: Since we use --no-index, maybe it would make sense to allow using @@ -360,8 +364,17 @@ See also `grep-process-setup'." ;; subcommand and turning colors on/off happens *after*, so ;; `color-arguments' needs to include the subcommand "grep". (color-arguments ('nil '("grep" "--no-color")) - (_ '("-c" "color.grep.filename=magenta" "-c" - "color.grep.match=bold red" "grep" "--color")))) + (_ '("-c" "color.grep.filename=magenta" + "-c" "color.grep.match=bold red" + "-c" "color.grep.context=" + "-c" "color.grep.function=" + "-c" "color.grep.lineNumber=" + "-c" "color.grep.column=" + "-c" "color.grep.matchContext=" + "-c" "color.grep.matchSelected=" + "-c" "color.grep.selected=" + "-c" "color.grep.separator=" + "grep" "--color")))) (grep (executable-name . "grep") (regexp-syntax bre ere pcre)