[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/urgrep 9e1f4da53b 070/115: Reorder keyword arguments to
|
From: |
ELPA Syncer |
|
Subject: |
[elpa] externals/urgrep 9e1f4da53b 070/115: Reorder keyword arguments to be more logical |
|
Date: |
Wed, 10 May 2023 03:00:45 -0400 (EDT) |
branch: externals/urgrep
commit 9e1f4da53b95ecb1843082f240a63ff4e84517ed
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Jim Porter <jporterbugs@gmail.com>
Reorder keyword arguments to be more logical
---
urgrep.el | 120 +++++++++++++++++++++++++++++++-------------------------------
1 file changed, 60 insertions(+), 60 deletions(-)
diff --git a/urgrep.el b/urgrep.el
index da9a942a7e..b6e64c8772 100644
--- a/urgrep.el
+++ b/urgrep.el
@@ -178,10 +178,10 @@ and escapes null characters."
((or `(,c . ,c) (and c (pred numberp))) (list (format "-C%d" c)))
(`(,b . ,a) (list (format "-B%d" b) (format "-A%d" a)))))
-(cl-defun urgrep--rgrep-command (query &key tool regexp case-fold context files
+(cl-defun urgrep--rgrep-command (query &key tool regexp case-fold files context
color &allow-other-keys)
"Get the command to run for QUERY when using rgrep.
-Optional keys TOOL, REGEXP, CASE-FOLD, CONTEXT, FILES, and COLOR are
+Optional keys TOOL, REGEXP, CASE-FOLD, FILES< CONTEXT, and COLOR are
as in `urgrep-command'."
(grep-compute-defaults)
;; Locally add options to `grep-find-template' that grep.el isn't aware of.
@@ -217,12 +217,6 @@ See also `grep-process-setup'."
(regexp-syntax bre ere pcre)
(arguments executable color "-n" "--ignore-files" file-wildcards group
context case-fold regexp "-e" query)
- (color-arguments
- ('nil '("--color=never"))
- (_ '("--color=always"
- "--colors=mt=01;31:fn=35:ln=:bn=:se=:sl=:cx=:ne")))
- (group-arguments ((pred identity) '("--heading" "--break")))
- (context-arguments . ,urgrep--context-arguments)
(regexp-arguments ('bre '("-G"))
('ere '("-E"))
('pcre '("-P"))
@@ -230,56 +224,62 @@ See also `grep-process-setup'."
(case-fold-arguments ((pred identity) '("-i")))
(file-wildcards-arguments
((and x (pred identity))
- (mapcar (lambda (i) (concat "--include=" i)) x))))
+ (mapcar (lambda (i) (concat "--include=" i)) x)))
+ (group-arguments ((pred identity) '("--heading" "--break")))
+ (context-arguments . ,urgrep--context-arguments)
+ (color-arguments
+ ('nil '("--color=never"))
+ (_ '("--color=always"
+ "--colors=mt=01;31:fn=35:ln=:bn=:se=:sl=:cx=:ne"))))
(ripgrep
(executable-name . "rg")
(regexp-syntax pcre)
(arguments executable color file-wildcards group context case-fold regexp
"--" query)
- (color-arguments ('nil '("--color" "never"))
- (_ '("--color" "always" "--colors" "path:fg:magenta"
- "--colors" "match:fg:red" "--colors"
- "match:style:bold")))
- (group-arguments ('nil '("--no-heading"))
- (_ '("--heading")))
- (context-arguments . ,urgrep--context-arguments)
(regexp-arguments ('nil '("-F")))
(case-fold-arguments ((pred identity) '("-i")))
(file-wildcards-arguments
((and x (pred identity))
- (flatten-list (mapcar (lambda (i) (cons "-g" i)) x)))))
+ (flatten-list (mapcar (lambda (i) (cons "-g" i)) x))))
+ (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"))))
(ag
(executable-name . "ag")
(regexp-syntax pcre)
(arguments executable color file-wildcards group context case-fold regexp
"--" query)
- (color-arguments ('nil '("--nocolor"))
- (_ '("--color-path" "35" "--color-match" "1;31")))
- (group-arguments ('nil '("--nogroup"))
- (_ '("--group")))
- (context-arguments . ,urgrep--context-arguments)
(regexp-arguments ('nil '("-Q")))
(case-fold-arguments ('nil '("-s"))
(_ '("-i")))
(file-wildcards-arguments
((and x (pred identity))
- (list "-G" (urgrep--wildcards-to-regexp x 'pcre)))))
+ (list "-G" (urgrep--wildcards-to-regexp x 'pcre))))
+ (group-arguments ('nil '("--nogroup"))
+ (_ '("--group")))
+ (context-arguments . ,urgrep--context-arguments)
+ (color-arguments ('nil '("--nocolor"))
+ (_ '("--color-path" "35" "--color-match" "1;31"))))
(ack
(executable-name . "ack")
(regexp-syntax pcre)
(arguments executable color file-wildcards group context case-fold regexp
"--" query)
- (color-arguments ('nil '("--nocolor"))
- (_ '("--color-filename" "magenta" "--color-match"
- "bold red")))
- (group-arguments ('nil '("--nogroup"))
- (_ '("--group")))
- (context-arguments . ,urgrep--context-arguments)
(regexp-arguments ('nil '("-Q")))
(case-fold-arguments ((pred identity) '("-i")))
(file-wildcards-arguments
((and x (pred identity))
- (list "-G" (urgrep--wildcards-to-regexp x 'pcre)))))
+ (list "-G" (urgrep--wildcards-to-regexp x 'pcre))))
+ (group-arguments ('nil '("--nogroup"))
+ (_ '("--group")))
+ (context-arguments . ,urgrep--context-arguments)
+ (color-arguments ('nil '("--nocolor"))
+ (_ '("--color-filename" "magenta" "--color-match"
+ "bold red"))))
(git-grep
(executable-name . "git")
;; XXX: Since we use --no-index, maybe it would make sense to allow using
@@ -290,26 +290,25 @@ See also `grep-process-setup'."
(arguments executable "--no-pager" color "--no-index" "--exclude-standard"
"-n" group context case-fold regexp "-e" query "--"
file-wildcards)
- ;; git is a bit odd in that color specification happens *before* the
- ;; 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")))
- (group-arguments ((pred identity) '("--heading" "--break")))
- (context-arguments . ,urgrep--context-arguments)
(regexp-arguments ('bre '("-G"))
('ere '("-E"))
('pcre '("-P"))
(_ '("-F")))
(case-fold-arguments ((pred identity) '("-i")))
- (file-wildcards-arguments (x x)))
+ (file-wildcards-arguments (x x))
+ (group-arguments ((pred identity) '("--heading" "--break")))
+ (context-arguments . ,urgrep--context-arguments)
+ ;; git is a bit odd in that color specification happens *before* the
+ ;; 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"))))
(grep
(executable-name . "grep")
(regexp-syntax bre ere pcre)
(command-function . ,#'urgrep--rgrep-command)
(process-setup . ,#'urgrep--rgrep-process-setup)
- (context-arguments . ,urgrep--context-arguments)
;; XXX: On MS Windows, -P and -F seem to cause issues due to the default
;; locale. Setting LC_ALL=en_US.utf8 fixes this, but I'm not sure if this
;; is the right thing to do in general...
@@ -317,7 +316,8 @@ See also `grep-process-setup'."
('ere '("-E"))
('pcre '("-P"))
(_ '("-F")))
- (case-fold-arguments ((pred identity) '("-i")))))
+ (case-fold-arguments ((pred identity) '("-i")))
+ (context-arguments . ,urgrep--context-arguments)))
"An alist of known tools to try when running urgrep.")
(defcustom urgrep-preferred-tools nil
@@ -430,8 +430,8 @@ for MS shells."
(t (car tool-syntaxes)))))
;;;###autoload
-(cl-defun urgrep-command (query &key tool (group t) regexp (case-fold 'inherit)
- (context 0) files (color t))
+(cl-defun urgrep-command (query &key tool regexp (case-fold 'inherit) files
+ (group t) (context 0) (color t))
"Return a command to use to search for QUERY.
Several keyword arguments can be supplied to adjust the resulting
command:
@@ -439,9 +439,6 @@ command:
TOOL: a tool from `urgrep-tools': a key-value pair from the list, just
the key, or nil to use the default tool.
-GROUP: show results grouped by filename (t, the default), or if nil,
-prefix the filename on each result line.
-
REGEXP: the style of regexp to use for results; one of nil (fixed
strings), `bre' (basic regexp), `ere' (extend regexp), `pcre'
\(Perl-compatible regexp), or t (the default regexp style stored in
@@ -450,12 +447,15 @@ strings), `bre' (basic regexp), `ere' (extend regexp),
`pcre'
CASE-FOLD: determine whether QUERY is case-sensitive or not; possible
values are as `urgrep-case-fold', defaulting to `inherit'.
+FILES: a wildcard (or list of wildcards) to limit the files searched.
+
+GROUP: show results grouped by filename (t, the default), or if nil,
+prefix the filename on each result line.
+
CONTEXT: the number of lines of context to show around results; either
an integer (to show the same number of lines before and after) or a
cons (to show CAR and CDR lines before and after, respectively).
-FILES: a wildcard (or list of wildcards) to limit the files searched.
-
COLOR: non-nil (the default) if the output should use color."
(let* ((regexp-syntax (if (eq regexp t) urgrep-regexp-syntax regexp))
(files (if (listp files) files (list files)))
@@ -471,8 +471,8 @@ COLOR: non-nil (the default) if the output should use
color."
;; Build the command arguments.
(if cmd-fun
(funcall cmd-fun query :tool tool :regexp regexp-syntax
- :case-fold case-fold :context context :files files
- :color color)
+ :case-fold case-fold :files files :group group
+ :context context :color color)
(let* ((executable (urgrep--get-prop 'executable-name tool))
(arguments (urgrep--get-prop 'arguments tool)))
(setq arguments (cl-substitute executable 'executable arguments))
@@ -480,9 +480,9 @@ COLOR: non-nil (the default) if the output should use
color."
;; Fill in various options according to the tool's argument syntax.
(pcase-dolist (`(,k . ,v) `((regexp . ,tool-re-syntax)
(case-fold . ,case-fold)
- (context . ,context)
- (group . ,group)
(file-wildcards . ,files)
+ (group . ,group)
+ (context . ,context)
(color . ,color)))
(let* ((prop (intern (concat (symbol-name k) "-arguments")))
(args (urgrep--get-prop-pcase prop tool v)))
@@ -927,19 +927,19 @@ future searches."
(define-key map "\M-sA" #'urgrep-set-after-context)
map))
-(cl-defun urgrep--read-query (initial &key tool (group urgrep-group-matches)
- (regexp urgrep-search-regexp)
+(cl-defun urgrep--read-query (initial &key tool (regexp urgrep-search-regexp)
(case-fold urgrep-case-fold)
- (context urgrep-context-lines)
- (files urgrep-file-wildcards))
+ (files urgrep-file-wildcards)
+ (group urgrep-group-matches)
+ (context urgrep-context-lines))
"Prompt the user for a search query starting with an INITIAL value.
Return a list that can be passed to `urgrep-command' to turn into a shell
command. TOOL, GROUP, REGEXP, CASE-FOLD, CONTEXT, and FILES are as in
`urgrep-command'."
(let* ((urgrep-search-regexp regexp)
(urgrep-case-fold case-fold)
- (urgrep-context-lines context)
(urgrep-file-wildcards files)
+ (urgrep-context-lines context)
(default (and (not initial) (urgrep--search-default)))
(prompt (urgrep--search-prompt default))
(query (minibuffer-with-setup-hook
@@ -947,9 +947,9 @@ command. TOOL, GROUP, REGEXP, CASE-FOLD, CONTEXT, and
FILES are as in
(read-from-minibuffer prompt initial urgrep-minibuffer-map
nil
'urgrep-search-history default)))
(query (if (equal query "") default query)))
- (list query :tool (urgrep-get-tool tool) :group group
- :regexp urgrep-search-regexp :case-fold urgrep-case-fold
- :context urgrep-context-lines :files urgrep-file-wildcards)))
+ (list query :tool (urgrep-get-tool tool) :regexp urgrep-search-regexp
+ :case-fold urgrep-case-fold :files urgrep-file-wildcards :group group
+ :context urgrep-context-lines)))
(defun urgrep--read-command (command)
"Read a shell command to use for searching, with initial value COMMAND."
- [elpa] externals/urgrep 8bb469a526 036/115: Add some details about our buffer-local variables, (continued)
- [elpa] externals/urgrep 8bb469a526 036/115: Add some details about our buffer-local variables, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 9ff22a4481 041/115: Minor fixes to defcustoms, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep c879c02558 040/115: Add some docs and clean up spacing, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 5b792fe0de 045/115: Use symbols instead of strings for `urgrep-tools' keys, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 3dde21c501 047/115: Add `urgrep-setup-hook', ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep f686c2baa3 051/115: Fix off-by-one error with matches in Emacs 28; see Emacs bug#49624, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep a9c1a98ea6 052/115: Prompt for directory first with 'C-u C-u M-x urgrep', ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 3002fdf731 054/115: Add support for specifying executable path in 'urgrep-preferred-tools', ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 55b0030cf9 061/115: Improve regexes to match result/context lines, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep f354b44121 059/115: Always filter filenames in 'urgrep-filter', ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 9e1f4da53b 070/115: Reorder keyword arguments to be more logical,
ELPA Syncer <=
- [elpa] externals/urgrep 0687d9e867 073/115: Update copyright, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep ce07e97d37 088/115: Allow ANSI escapes for matches to end just after a newline, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep dbb2c2caeb 095/115: Wrap some docstring lines with "\", ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 9949a5b296 094/115: Use connection-local variables for caching the tool to use for each host, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 569c52f504 083/115: Allow overriding EMACS during tests, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep d479dc5ad6 104/115: Remove unnecessary/wrong Git grep color settings, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep d0012b9fcb 112/115: Tweak tests so they only work around Emacs bug#58265 on older versions, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep 392e4bcb98 008/115: Don't inherit from compilation-minor-mode to avoid its menu, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep c7a3cc5b30 015/115: Be less aggressive with shell-quoting on MS Windows, ELPA Syncer, 2023/05/10
- [elpa] externals/urgrep bfab29d1d7 014/115: Add support for searches starting with "-", ELPA Syncer, 2023/05/10