unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Trent W. Buck" <twb@cybersource.com.au>
To: Glenn Morris <rgm@gnu.org>
Cc: 4403@emacsbugs.donarmstrong.com
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	[thread overview]
Message-ID: <20090915045518.GA4680@Clio> (raw)
In-Reply-To: <qhvdjkdiqr.fsf@fencepost.gnu.org>

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





  reply	other threads:[~2009-09-15  4:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2011-04-02 20:37     ` Glenn Morris

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=20090915045518.GA4680@Clio \
    --to=twb@cybersource.com.au \
    --cc=4403@emacsbugs.donarmstrong.com \
    --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).