* bug#4403: 23.1; find-dired: use "find -exec ls -ld {} +" or "find -ls" where available
@ 2009-09-11 9:09 trentbuck
2009-09-15 2:50 ` Glenn Morris
0 siblings, 1 reply; 4+ messages in thread
From: trentbuck @ 2009-09-11 9:09 UTC (permalink / raw)
To: bug-gnu-emacs
Recent versions of GNU find support the expressions
find <query> -exec ls -ld {} +
and
find <query> -ls
I believe these are also part of recent versions of the POSIX spec.
It would be great if M-x find dired RET automatically used these forms
instead of the less efficient
find <query> -exec ls -ld {} \;
that it currently uses. It would also mean that the output would line
up better, since
ls foo bar baz
will try to align the three lines, whereas
ls foo ; ls bar ; ls baz
won't.
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#4403: 23.1; find-dired: use "find -exec ls -ld {} +" or "find -ls" where available
2009-09-11 9:09 bug#4403: 23.1; find-dired: use "find -exec ls -ld {} +" or "find -ls" where available trentbuck
@ 2009-09-15 2:50 ` Glenn Morris
2009-09-15 4:55 ` Trent W. Buck
0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2009-09-15 2:50 UTC (permalink / raw)
To: trentbuck; +Cc: 4403
trentbuck@gmail.com wrote:
> Recent versions of GNU find support the expressions
>
> find <query> -exec ls -ld {} +
>
> and
>
> find <query> -ls
>
> I believe these are also part of recent versions of the POSIX spec.
>
> It would be great if M-x find dired RET automatically used these forms
You can use something like:
(setq find-ls-option
(let ((help (shell-command-to-string (format "%s --help" find-program))))
(if (string-match " -ls\\>" help)
'("-ls" . "-lids")
(if (string-match "{} \\+" help)
'("-exec ls -ld {} +" . "-ld")
'("-exec ls -ld {} \\;" . "-ld")))))
The -ls version changes the output format.
> It would also mean that the output would line up better
Surely dired already takes care of the alignment?
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#4403: 23.1; find-dired: use "find -exec ls -ld {} +" or "find -ls" where available
2009-09-15 2:50 ` Glenn Morris
@ 2009-09-15 4:55 ` Trent W. Buck
2011-04-02 20:37 ` Glenn Morris
0 siblings, 1 reply; 4+ messages in thread
From: Trent W. Buck @ 2009-09-15 4:55 UTC (permalink / raw)
To: Glenn Morris; +Cc: 4403
On Mon, Sep 14, 2009 at 10:50:04PM -0400, Glenn Morris wrote:
>> It would be great if M-x find dired RET automatically
>
> You can use something like:
>
> (setq find-ls-option
> (let ((help (shell-command-to-string (format "%s --help" find-program))))
> (if (string-match " -ls\\>" help)
> '("-ls" . "-lids")
> (if (string-match "{} \\+" help)
> '("-exec ls -ld {} +" . "-ld")
> '("-exec ls -ld {} \\;" . "-ld")))))
True. I guess I should have mentioned: I tried that a couple of years
ago, but it broke down when I tried TRAMP to a host that doesn't
support -exec {} + -- namely some FC3 and CentOS 4 servers. I suppose
that's really a separate TRAMP wishlist bug.
(The same thing happens with setting dired-listing-switches to "-Alh",
but I very rarely connect to a non-GNU server.)
> The -ls version changes the output format.
>
>> It would also mean that the output would line up better
>
> Surely dired already takes care of the alignment?
Nope. AFAIK M-x dired is aligned only because ls(1) handles
alignment. find-dired isn't aligned because ls(1) is called on files
one at a time. In some environments, GNU ls called on a single file
would align to a tab stop, so find-dired still *mostly* aligned things
nicely. Some (recent? locale-dependent?) versions didn't align to a
tab stop, so find-dired output was very hard to read, being completely
unaligned.
UPDATE: apparently I was wrong, because this is aligned normally, but
broken in find-dired:
find . \( -type d \) -exec ls -ldh {} +
(setq find-ls-option '("-exec ls -ldh {} +" . "-ldh"))
e.g. dired:
drwxr-xr-x 2 twb twb 12K 2009-07-06 13:53 SinFest
drwxr-xr-x 2 twb twb 4.0K 2009-09-01 21:55 VGCats
drwxr-xr-x 2 twb twb 12K 2009-09-15 11:39 xkcd
vs. find directly in shell:
drwxr-xr-x 2 twb twb 12K 2009-07-06 13:53 ./SinFest
drwxr-xr-x 2 twb twb 4.0K 2009-09-01 21:55 ./VGCats
drwxr-xr-x 2 twb twb 12K 2009-09-15 11:39 ./xkcd
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-04-02 20:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-11 9:09 bug#4403: 23.1; find-dired: use "find -exec ls -ld {} +" or "find -ls" where available trentbuck
2009-09-15 2:50 ` Glenn Morris
2009-09-15 4:55 ` Trent W. Buck
2011-04-02 20:37 ` Glenn Morris
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.