GNU bug report logs - #36110
find-dired not sorted on any field nor provides a way

Previous Next

Package: emacs;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Wed, 5 Jun 2019 23:37:01 UTC

Severity: wishlist

Merged with 29513, 36123

Found in version 25.2

Fixed in version 27.1

Done: "Roland Winkler" <winkler <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 36110 in the body.
You can then email your comments to 36110 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#36110; Package emacs. (Wed, 05 Jun 2019 23:37:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 05 Jun 2019 23:37:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: bug-gnu-emacs <at> gnu.org
Subject: find-dired not sorted on any field nor provides a way
Date: Thu, 06 Jun 2019 07:27:44 +0800
find-dired (info "(emacs) Dired and Find") is great, except it is not
sorted on any field, except coincidentally.
find-ls-option is a variable defined in ‘find-dired.el’, alas it only
governs each line and not how those lines are sorted.
Yes that is how find(1) works, but there should be a filter (default "|
sort ...") that sorts on the last field (name). Those people who prefer
jumbled order could unset it.

P.S., the modeline says (Dired by name:exit) which looks weird.
emacs-version "26.1"




Merged 29513 36110. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 05 Jun 2019 23:53:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36110; Package emacs. (Thu, 06 Jun 2019 20:54:02 GMT) Full text and rfc822 format available.

Message #10 received at 36110 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 36110 <at> debbugs.gnu.org
Subject: Re: bug#36110: find-dired not sorted on any field nor provides a way
Date: Thu, 06 Jun 2019 23:28:46 +0300
> find-dired (info "(emacs) Dired and Find") is great, except it is not
> sorted on any field, except coincidentally.
> find-ls-option is a variable defined in ‘find-dired.el’, alas it only
> governs each line and not how those lines are sorted.
> Yes that is how find(1) works, but there should be a filter (default "|
> sort ...") that sorts on the last field (name). Those people who prefer
> jumbled order could unset it.

Long ago I customized find-ls-option to this value

  (setq find-ls-option '("-exec ls -ld {} \\;" . "-ld"))

and forgot about such problems because this value produces
the same output as Dired.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36110; Package emacs. (Thu, 06 Jun 2019 21:22:02 GMT) Full text and rfc822 format available.

Message #13 received at 36110 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Juri Linkov <juri <at> linkov.net>,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 36110 <at> debbugs.gnu.org
Subject: RE: bug#36110: find-dired not sorted on any field nor provides a way
Date: Thu, 6 Jun 2019 14:21:04 -0700 (PDT)
> Long ago I customized find-ls-option to this value
> 
>   (setq find-ls-option '("-exec ls -ld {} \\;" . "-ld"))
> 
> and forgot about such problems because this value produces
> the same output as Dired.

Same here, although with this (minor) difference:

("-exec ls -ld {} \";\"" . "-ld")

Dunno where I got that or when I customized the value to it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36110; Package emacs. (Fri, 07 Jun 2019 00:26:02 GMT) Full text and rfc822 format available.

Message #16 received at 36110 <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 36110 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#36110: find-dired not sorted on any field nor provides a way
Date: Fri, 07 Jun 2019 08:25:33 +0800
>>>>> "DA" == Drew Adams <drew.adams <at> oracle.com> writes:
DA> Dunno where I got that or when I customized the value to it.

That's because nobody documented it in (info "(emacs) Dired and Find") !

So somebody please document it, else who likes going around with their
find-dired in "ls -U" order? What sense would that make?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36110; Package emacs. (Thu, 13 Jun 2019 22:33:01 GMT) Full text and rfc822 format available.

Message #19 received at 36110 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 36110 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#36110: find-dired not sorted on any field nor provides a way
Date: Fri, 14 Jun 2019 00:30:05 +0300
>>> Long ago I customized find-ls-option to this value
>>>
>>>   (setq find-ls-option '("-exec ls -ld {} \\;" . "-ld"))
>>>
>>> and forgot about such problems because this value produces
>>> the same output as Dired.
>>
>> Same here, although with this (minor) difference:
>>
>> ("-exec ls -ld {} \";\"" . "-ld")
>>
>> Dunno where I got that or when I customized the value to it.
>
> That's because nobody documented it in (info "(emacs) Dired and Find") !
>
> So somebody please document it, else who likes going around with their
> find-dired in "ls -U" order? What sense would that make?

The following patch documents it:

diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index 9f454ea2ad..2befcf1bbd 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -1340,7 +1340,9 @@ Dired and Find
   The format of listing produced by these commands is controlled by
 the variable @code{find-ls-option}.  This is a pair of options; the
 first specifying how to call @command{find} to produce the file listing,
-and the second telling Dired to parse the output.
+and the second telling Dired to parse the output.  To sort file names
+lexicographically, you can customize @code{find-ls-option} to the value
+@code{'("-exec ls -ld @{@} +" . "-ld")}

 @findex locate
 @findex locate-with-filter




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36110; Package emacs. (Thu, 13 Jun 2019 23:41:01 GMT) Full text and rfc822 format available.

Message #22 received at 36110 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 36110 <at> debbugs.gnu.org
Subject: Re: bug#36110: find-dired not sorted on any field nor provides a way
Date: Thu, 13 Jun 2019 19:40:11 -0400
Juri Linkov wrote:

>>>> Long ago I customized find-ls-option to this value
>>>>
>>>>   (setq find-ls-option '("-exec ls -ld {} \\;" . "-ld"))

But that has nothing to do with sorting?
find -exec ls -ld {} ";"
will give unsorted output, as always.

> -and the second telling Dired to parse the output.
> +and the second telling Dired to parse the output.  To sort file names
> +lexicographically, you can customize @code{find-ls-option} to the value
> +@code{'("-exec ls -ld @{@} +" . "-ld")}

Oh, I see you've changed it to the "+" form.
It looks like this does give sorted output, but I find it surprising.
Is it assured?

Anyway, this issue has been very recently fixed in bug#29513
(of which this is a duplicate) via find-dired-refine-function.
So I suggest not documenting the above.





bug Marked as fixed in versions 27.1. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 13 Jun 2019 23:43:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36110; Package emacs. (Fri, 14 Jun 2019 00:13:02 GMT) Full text and rfc822 format available.

Message #27 received at 36110 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 36110 <at> debbugs.gnu.org
Subject: Re: bug#36110: find-dired not sorted on any field nor provides a way
Date: Thu, 13 Jun 2019 20:12:14 -0400
Glenn Morris wrote:

>> +@code{'("-exec ls -ld @{@} +" . "-ld")}
>
> Oh, I see you've changed it to the "+" form.
> It looks like this does give sorted output, but I find it surprising.
> Is it assured?

I verified on a directory with a large number of files that the output
is not sorted. (I didn't see how it could be, given how find works.)
But it does appear as if individual "chunks" are sorted, which can give
the appearance of the whole output being sorted if you don't have a lot
of files.




Forcibly Merged 29513 36110 36123. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 14 Jun 2019 02:48:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36110; Package emacs. (Fri, 14 Jun 2019 06:07:02 GMT) Full text and rfc822 format available.

Message #32 received at 36110 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 36110 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#36110: find-dired not sorted on any field nor provides a way
Date: Fri, 14 Jun 2019 09:06:52 +0300
> From: Juri Linkov <juri <at> linkov.net>
> Date: Fri, 14 Jun 2019 00:30:05 +0300
> Cc: 36110 <at> debbugs.gnu.org
> 
> > So somebody please document it, else who likes going around with their
> > find-dired in "ls -U" order? What sense would that make?
> 
> The following patch documents it:
> 
> diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
> index 9f454ea2ad..2befcf1bbd 100644
> --- a/doc/emacs/dired.texi
> +++ b/doc/emacs/dired.texi
> @@ -1340,7 +1340,9 @@ Dired and Find
>    The format of listing produced by these commands is controlled by
>  the variable @code{find-ls-option}.  This is a pair of options; the
>  first specifying how to call @command{find} to produce the file listing,
> -and the second telling Dired to parse the output.
> +and the second telling Dired to parse the output.  To sort file names
> +lexicographically, you can customize @code{find-ls-option} to the value
> +@code{'("-exec ls -ld @{@} +" . "-ld")}

This should qualify the suggestion to using GNU Find, right?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36110; Package emacs. (Fri, 14 Jun 2019 06:19:01 GMT) Full text and rfc822 format available.

Message #35 received at 36110 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 36110 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#36110: find-dired not sorted on any field nor provides a way
Date: Fri, 14 Jun 2019 09:18:53 +0300
> From: Glenn Morris <rgm <at> gnu.org>
> Date: Thu, 13 Jun 2019 19:40:11 -0400
> Cc: 36110 <at> debbugs.gnu.org
> 
> > +@code{'("-exec ls -ld @{@} +" . "-ld")}
> 
> Oh, I see you've changed it to the "+" form.
> It looks like this does give sorted output, but I find it surprising.
> Is it assured?

It is assured because the GNU Find's documentation says this '+'
causes the command line to be created by appending the file names,
like xargs does.  However, problems should be expected when the number
of files becomes very large, subject to limitations of the target
platform.

> Anyway, this issue has been very recently fixed in bug#29513
> (of which this is a duplicate) via find-dired-refine-function.
> So I suggest not documenting the above.

We could document both ways.

Btw, the commit which fixed bug#29513 didn't call out the change in
NEWS, let alone in the manual, so we should definitely improve the
docs regarding this issue anyway.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36110; Package emacs. (Fri, 14 Jun 2019 06:28:01 GMT) Full text and rfc822 format available.

Message #38 received at 36110 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 36110 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#36110: find-dired not sorted on any field nor provides a way
Date: Fri, 14 Jun 2019 08:26:57 +0200
On Jun 13 2019, Glenn Morris <rgm <at> gnu.org> wrote:

> Glenn Morris wrote:
>
>>> +@code{'("-exec ls -ld @{@} +" . "-ld")}
>>
>> Oh, I see you've changed it to the "+" form.
>> It looks like this does give sorted output, but I find it surprising.
>> Is it assured?
>
> I verified on a directory with a large number of files that the output
> is not sorted. (I didn't see how it could be, given how find works.)
> But it does appear as if individual "chunks" are sorted, which can give
> the appearance of the whole output being sorted if you don't have a lot
> of files.

They are sorted by ls, for each invocation of it.  But it is unspecified
how find will split the invocations if there are more files than fit on
the command line.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36110; Package emacs. (Fri, 14 Jun 2019 19:18:02 GMT) Full text and rfc822 format available.

Message #41 received at 36110 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 36110 <at> debbugs.gnu.org
Subject: Re: bug#36110: find-dired not sorted on any field nor provides a way
Date: Fri, 14 Jun 2019 22:09:10 +0300
[Message part 1 (text/plain, inline)]
>>> +@code{'("-exec ls -ld @{@} +" . "-ld")}
>>
>> Oh, I see you've changed it to the "+" form.

I've changed it to the same value as in `find-exec-terminator'.
So instead of documenting a command with a terminator that depends
on the value of `find-exec-terminator', better would be to provide
different customizable options like in the patch below.

>> It looks like this does give sorted output, but I find it surprising.
>> Is it assured?
>
> I verified on a directory with a large number of files that the output
> is not sorted. (I didn't see how it could be, given how find works.)
> But it does appear as if individual "chunks" are sorted, which can give
> the appearance of the whole output being sorted if you don't have a lot
> of files.

I tried to run different commands on all files in the Emacs source tree:

1. find . -ls

It produces completely unsorted output.

2. find . -exec ls -ld {} +

It splits the output into sizeable chunks and sorts files
inside every chunk, so the boundary between chunks
is clearly visible, e.g.:

-rw-rw-r--  1 juri juri     6191 May  1 23:49 ./test/src/timefns-tests.el
-rw-r--r--  1 juri juri    13623 Jan  2 22:43 ./test/src/undo-tests.el
-rw-r--r--  1 juri juri     2915 Jan  2 22:43 ./test/src/xml-tests.el
drwxr-xr-x   2 juri juri      4096 Jun 11 00:09 ./autom4te.cache
-rw-rw-r--   1 juri juri    945417 Jun 11 00:09 ./autom4te.cache/output.0
-rw-r--r--   1 juri juri      3431 Jun 11 00:09 ./autom4te.cache/requests

3. find . -print0 | sort -z | xargs -0 -e ls -ld

It splits files into chinks, but maintains the sorting order
among all files.   Its only drawback is misaligned chunks, e.g.:

-rw-rw-r--   1 juri juri     62707 May 21 00:04 ./info/forms.info
-rw-rw-r--   1 juri juri   1476691 Jun 11 00:16 ./info/gnus.info
-rw-rw-r--   1 juri juri     74148 May 21 00:04 ./info/htmlfontify.info
-rw-rw-r--  1 juri juri   234730 May 21 00:04 ./info/idlwave.info
-rw-rw-r--  1 juri juri    51892 May 21 00:04 ./info/ido.info
-rw-rw-r--  1 juri juri    84948 May 21 00:04 ./info/info.info

Since an output with more than 5000 files (an approx amount in each chuck
in this experiment) is unmanageable by human users, any of the last 2 options
is sufficiently good.  So here is the patch that allows the user
to choose among these options:

[find-ls-option-default.patch (text/x-diff, inline)]
diff --git a/lisp/find-dired.el b/lisp/find-dired.el
index 2c76179da0..c563ae533a 100644
--- a/lisp/find-dired.el
+++ b/lisp/find-dired.el
@@ -51,19 +51,23 @@ find-exec-terminator
   :group 'find-dired
   :type 'string)
 
+(defvar find-ls-option-default-ls
+  (cons "-ls" (if (eq system-type 'berkeley-unix) "-gilsb" "-dilsb")))
+
+(defvar find-ls-option-default-exec
+  (cons (format "-exec ls -ld {} %s" find-exec-terminator) "-ld"))
+
+(defvar find-ls-option-default-xargs
+  (cons "-print0 | sort -z | xargs -0 -e ls -ld" "-ld"))
+
 ;; find's -ls corresponds to these switches.
 ;; Note -b, at least GNU find quotes spaces etc. in filenames
 (defcustom find-ls-option
   (if (eq 0
 	  (ignore-errors
 	    (process-file find-program nil nil nil null-device "-ls")))
-      (cons "-ls"
-	    (if (eq system-type 'berkeley-unix)
-		"-gilsb"
-	      "-dilsb"))
-    (cons
-     (format "-exec ls -ld {} %s" find-exec-terminator)
-     "-ld"))
+      find-ls-option-default-ls
+    find-ls-option-default-exec)
   "A pair of options to produce and parse an `ls -l'-type list from `find'.
 This is a cons of two strings (FIND-OPTION . LS-SWITCHES).
 FIND-OPTION is the option (or options) passed to `find' to produce
@@ -78,9 +82,20 @@ find-ls-option
    (\"-ls\" . \"-dilsb\")
 since GNU find's output has the same format as using GNU ls with
 the options \"-dilsb\"."
-  :version "24.1"	       ; add tests for -ls and -exec + support
-  :type '(cons (string :tag "Find Option")
-	       (string :tag "Ls Switches"))
+  :version "27.1"            ; add choice of predefined set of options
+  :type `(choice
+          (cons :tag "find -ls"
+                (string ,(car find-ls-option-default-ls))
+                (string ,(cdr find-ls-option-default-ls)))
+          (cons :tag "find -exec ls -ld"
+                (string ,(car find-ls-option-default-exec))
+                (string ,(cdr find-ls-option-default-exec)))
+          (cons :tag "find -print | sort | xargs"
+                (string ,(car find-ls-option-default-xargs))
+                (string ,(cdr find-ls-option-default-xargs)))
+          (cons :tag "Other values"
+                (string :tag "Find Option")
+                (string :tag "Ls Switches")))
   :group 'find-dired)
 
 (defcustom find-ls-subdir-switches

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36110; Package emacs. (Fri, 14 Jun 2019 19:18:03 GMT) Full text and rfc822 format available.

Message #44 received at 36110 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 36110 <at> debbugs.gnu.org
Subject: Re: bug#36110: find-dired not sorted on any field nor provides a way
Date: Fri, 14 Jun 2019 22:10:23 +0300
[Message part 1 (text/plain, inline)]
In addition to the previous patch, it also makes sense to add similar
options to grep:

[grep-find-use-xargs.patch (text/x-diff, inline)]
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))

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36110; Package emacs. (Fri, 14 Jun 2019 19:18:03 GMT) Full text and rfc822 format available.

Message #47 received at 36110 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 36110 <at> debbugs.gnu.org, Glenn Morris <rgm <at> gnu.org>
Subject: Re: bug#36110: find-dired not sorted on any field nor provides a way
Date: Fri, 14 Jun 2019 22:12:07 +0300
>> Anyway, this issue has been very recently fixed in bug#29513
>> (of which this is a duplicate) via find-dired-refine-function.
>> So I suggest not documenting the above.
>
> We could document both ways.
>
> Btw, the commit which fixed bug#29513 didn't call out the change in
> NEWS, let alone in the manual, so we should definitely improve the
> docs regarding this issue anyway.

Also I see no way to disable its default value with something like:

diff --git a/lisp/find-dired.el b/lisp/find-dired.el
index 2c76179da0..c563ae533a 100644
--- a/lisp/find-dired.el
+++ b/lisp/find-dired.el
@@ -123,7 +138,10 @@ find-dired-refine-function
 output of `find' (one file per line) when this function is called."
   :version "27.1"
   :group 'find-dired
-  :type 'function)
+  :type '(choice (const :tag "Sort file names lexicographically"
+                        find-dired-sort-by-filename)
+                 (function :tag "Refining function")
+                 (const :tag "No refining" nil)))
 
 (defvar find-args nil
   "Last arguments given to `find' by \\[find-dired].")




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36110; Package emacs. (Sat, 15 Jun 2019 23:18:02 GMT) Full text and rfc822 format available.

Message #50 received at 36110 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 36110 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#36110: find-dired not sorted on any field nor provides a way
Date: Sun, 16 Jun 2019 01:36:45 +0300
>> diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
>> index 9f454ea2ad..2befcf1bbd 100644
>> --- a/doc/emacs/dired.texi
>> +++ b/doc/emacs/dired.texi
>> @@ -1340,7 +1340,9 @@ Dired and Find
>>    The format of listing produced by these commands is controlled by
>>  the variable @code{find-ls-option}.  This is a pair of options; the
>>  first specifying how to call @command{find} to produce the file listing,
>> -and the second telling Dired to parse the output.
>> +and the second telling Dired to parse the output.  To sort file names
>> +lexicographically, you can customize @code{find-ls-option} to the value
>> +@code{'("-exec ls -ld @{@} +" . "-ld")}
>
> This should qualify the suggestion to using GNU Find, right?

grep-find-use-xargs defines such a command as `exec',
whereas GNU Find is defined as a combination of `find -print0'
and `xargs -0'.  From docstring of grep-find-use-xargs:

 If `exec', use `find -exec {} ;'.
 If `exec-plus' use `find -exec {} +'.
 If `gnu', use `find -print0' and `xargs -0'.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36110; Package emacs. (Sun, 16 Jun 2019 02:40:02 GMT) Full text and rfc822 format available.

Message #53 received at 36110 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 36110 <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#36110: find-dired not sorted on any field nor provides a way
Date: Sun, 16 Jun 2019 05:39:05 +0300
> From: Juri Linkov <juri <at> linkov.net>
> Cc: jidanni <at> jidanni.org,  36110 <at> debbugs.gnu.org
> Date: Sun, 16 Jun 2019 01:36:45 +0300
> 
> >> diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
> >> index 9f454ea2ad..2befcf1bbd 100644
> >> --- a/doc/emacs/dired.texi
> >> +++ b/doc/emacs/dired.texi
> >> @@ -1340,7 +1340,9 @@ Dired and Find
> >>    The format of listing produced by these commands is controlled by
> >>  the variable @code{find-ls-option}.  This is a pair of options; the
> >>  first specifying how to call @command{find} to produce the file listing,
> >> -and the second telling Dired to parse the output.
> >> +and the second telling Dired to parse the output.  To sort file names
> >> +lexicographically, you can customize @code{find-ls-option} to the value
> >> +@code{'("-exec ls -ld @{@} +" . "-ld")}
> >
> > This should qualify the suggestion to using GNU Find, right?
> 
> grep-find-use-xargs defines such a command as `exec',
> whereas GNU Find is defined as a combination of `find -print0'
> and `xargs -0'.  From docstring of grep-find-use-xargs:
> 
>  If `exec', use `find -exec {} ;'.
>  If `exec-plus' use `find -exec {} +'.
>  If `gnu', use `find -print0' and `xargs -0'.

I meant the "+" part, I think it's GNU-specific?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36110; Package emacs. (Sun, 16 Jun 2019 08:38:02 GMT) Full text and rfc822 format available.

Message #56 received at 36110 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 36110 <at> debbugs.gnu.org, jidanni <at> jidanni.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#36110: find-dired not sorted on any field nor provides a way
Date: Sun, 16 Jun 2019 10:37:50 +0200
On Jun 16 2019, Eli Zaretskii <eliz <at> gnu.org> wrote:

>> grep-find-use-xargs defines such a command as `exec',
>> whereas GNU Find is defined as a combination of `find -print0'
>> and `xargs -0'.  From docstring of grep-find-use-xargs:
>> 
>>  If `exec', use `find -exec {} ;'.
>>  If `exec-plus' use `find -exec {} +'.
>>  If `gnu', use `find -print0' and `xargs -0'.
>
> I meant the "+" part, I think it's GNU-specific?

exec-plus is POSIX (originating from SVR4).

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36110; Package emacs. (Sun, 16 Jun 2019 14:03:01 GMT) Full text and rfc822 format available.

Message #59 received at 36110 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 36110 <at> debbugs.gnu.org, jidanni <at> jidanni.org, juri <at> linkov.net
Subject: Re: bug#36110: find-dired not sorted on any field nor provides a way
Date: Sun, 16 Jun 2019 17:02:13 +0300
> From: Andreas Schwab <schwab <at> linux-m68k.org>
> Cc: Juri Linkov <juri <at> linkov.net>,  36110 <at> debbugs.gnu.org,  jidanni <at> jidanni.org
> Date: Sun, 16 Jun 2019 10:37:50 +0200
> 
> On Jun 16 2019, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
> > I meant the "+" part, I think it's GNU-specific?
> 
> exec-plus is POSIX (originating from SVR4).

Thanks.  Then there's no need to qualify anything.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 15 Jul 2019 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 342 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.