bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#36110: find-dired not sorted on any field nor provides a way


From: Juri Linkov
Subject: bug#36110: find-dired not sorted on any field nor provides a way
Date: Fri, 14 Jun 2019 22:10:23 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

In addition to the previous patch, it also makes sense to add similar
options to grep:

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))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]