From: Glenn Morris Date: Wed, 13 Jul 2011 17:34:31 +0000 (-0400) Subject: Small dired fixes related to bug#9039. X-Git-Url: http://git.hcoop.net/bpt/emacs.git/commitdiff_plain/6240145a7f5a355575a5ca3206e89c3baba95b3c Small dired fixes related to bug#9039. * lisp/dired.el (dired-use-ls-dired): Doc fix. (dired-insert-directory): Give a message the first time if ls is found not to support --dired. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c5eb9f94e5..22f5d304f6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2011-07-13 Glenn Morris + + * dired.el (dired-use-ls-dired): Doc fix. (Bug#9039). + (dired-insert-directory): Give a message the first time + if ls is found not to support --dired. + 2011-07-13 Lars Magne Ingebrigtsen * simple.el (toggle-truncate-lines): Clarify what is toggled diff --git a/lisp/dired.el b/lisp/dired.el index 96709ffecd..3606e3df33 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -78,10 +78,22 @@ If nil, `dired-listing-switches' is used." :type 'file) (defcustom dired-use-ls-dired 'unspecified - "Non-nil means Dired should use \"ls --dired\". + "Non-nil means Dired should pass the \"--dired\" option to \"ls\". The special value of `unspecified' means to check explicitly, and save the result in this variable. This is performed the first -time `dired-insert-directory' is called." +time `dired-insert-directory' is called. + +Note that if you set this option to nil, either through choice or +because your \"ls\" program does not support \"--dired\", Dired +will fail to parse some \"unusual\" file names, e.g. those with leading +spaces. You might want to install ls from GNU Coreutils, which does +support this option. Alternatively, you might want to use Emacs's +own emulation of \"ls\", by using: + \(setq ls-lisp-use-insert-directory-program nil) + \(require 'ls-lisp) +This is used by default on MS Windows, which does not have an \"ls\" program. +Note that `ls-lisp' does not support as many options as GNU ls, though. +For more details, see Info node `(emacs)ls in Lisp'." :group 'dired :type '(choice (const :tag "Check for --dired support" unspecified) (const :tag "Do not use --dired" nil) @@ -1119,9 +1131,13 @@ If HDR is non-nil, insert a header line with the directory name." (or (if (eq dired-use-ls-dired 'unspecified) ;; Check whether "ls --dired" gives exit code 0, and ;; save the answer in `dired-use-ls-dired'. - (setq dired-use-ls-dired - (eq (call-process insert-directory-program nil nil nil "--dired") - 0)) + (or (setq dired-use-ls-dired + (eq 0 (call-process insert-directory-program + nil nil nil "--dired"))) + (progn + (message "ls does not support --dired; \ +see `dired-use-ls-dired' for more details.") + nil)) dired-use-ls-dired) (file-remote-p dir))) (setq switches (concat "--dired " switches)))