From: Juri Linkov <juri@linkov.net>
To: Glenn Morris <rgm@gnu.org>
Cc: 36110@debbugs.gnu.org
Subject: bug#36110: find-dired not sorted on any field nor provides a way
Date: Fri, 14 Jun 2019 22:10:23 +0300 [thread overview]
Message-ID: <8736kc0yqo.fsf@mail.linkov.net> (raw)
In-Reply-To: <lyd0jh6n4x.fsf@fencepost.gnu.org> (Glenn Morris's message of "Thu, 13 Jun 2019 20:12:14 -0400")
[-- Attachment #1: Type: text/plain, Size: 88 bytes --]
In addition to the previous patch, it also makes sense to add similar
options to grep:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: grep-find-use-xargs.patch --]
[-- Type: text/x-diff, Size: 2202 bytes --]
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 79178c4346..67222f7862 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -511,14 +511,24 @@ xargs-program
This variable's value takes effect when `grep-compute-defaults' is called.")
;;;###autoload
-(defvar grep-find-use-xargs nil
+(defcustom grep-find-use-xargs nil
"How to invoke find and grep.
If `exec', use `find -exec {} ;'.
If `exec-plus' use `find -exec {} +'.
If `gnu', use `find -print0' and `xargs -0'.
+If `gnu-sort', use `find -print0', `sort -z' and `xargs -0'.
Any other value means to use `find -print' and `xargs'.
-This variable's value takes effect when `grep-compute-defaults' is called.")
+This variable's value takes effect when `grep-compute-defaults' is called."
+ :type '(choice (const :tag "find -exec {} ;" exec)
+ (const :tag "find -exec {} +" exec-plus)
+ (const :tag "find -print0 | xargs -0" gnu)
+ (const :tag "find -print0 | sort -z | xargs -0'" gnu-sort)
+ string
+ (const :tag "Not Set" nil))
+ :set 'grep-apply-setting
+ :version "27.1"
+ :group 'grep)
;; History of grep commands.
;;;###autoload
@@ -728,6 +738,9 @@ grep-compute-defaults
;; forward slashes as directory separators.
(format "%s . -type f -print0 | \"%s\" -0 %s"
find-program xargs-program grep-command))
+ ((eq grep-find-use-xargs 'gnu-sort)
+ (format "%s . -type f -print0 | sort -z | \"%s\" -0 %s"
+ find-program xargs-program grep-command))
((memq grep-find-use-xargs '(exec exec-plus))
(let ((cmd0 (format "%s . -type f -exec %s"
find-program grep-command))
@@ -752,6 +765,9 @@ grep-compute-defaults
(cond ((eq grep-find-use-xargs 'gnu)
(format "%s <D> <X> -type f <F> -print0 | \"%s\" -0 %s"
find-program xargs-program gcmd))
+ ((eq grep-find-use-xargs 'gnu-sort)
+ (format "%s <D> <X> -type f <F> -print0 | sort -z | \"%s\" -0 %s"
+ find-program xargs-program gcmd))
((eq grep-find-use-xargs 'exec)
(format "%s <D> <X> -type f <F> -exec %s %s %s%s"
find-program gcmd quot-braces null quot-scolon))
next prev parent reply other threads:[~2019-06-14 19:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-05 23:27 bug#36110: find-dired not sorted on any field nor provides a way 積丹尼 Dan Jacobson
2019-06-06 20:28 ` Juri Linkov
2019-06-06 21:21 ` Drew Adams
2019-06-07 0:25 ` 積丹尼 Dan Jacobson
2019-06-13 21:30 ` Juri Linkov
2019-06-13 23:40 ` Glenn Morris
2019-06-14 0:12 ` Glenn Morris
2019-06-14 6:26 ` Andreas Schwab
2019-06-14 19:09 ` Juri Linkov
2019-06-14 19:10 ` Juri Linkov [this message]
2019-06-14 6:18 ` Eli Zaretskii
2019-06-14 19:12 ` Juri Linkov
2019-06-14 6:06 ` Eli Zaretskii
2019-06-15 22:36 ` Juri Linkov
2019-06-16 2:39 ` Eli Zaretskii
2019-06-16 8:37 ` Andreas Schwab
2019-06-16 14:02 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8736kc0yqo.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=36110@debbugs.gnu.org \
--cc=rgm@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).