[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#4403: 23.1; find-dired: use "find -exec ls -ld {} +" or "find -ls" w
From: |
Trent W. Buck |
Subject: |
bug#4403: 23.1; find-dired: use "find -exec ls -ld {} +" or "find -ls" where available |
Date: |
Tue, 15 Sep 2009 14:55:18 +1000 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
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