Small dired fixes related to bug#9039.
authorGlenn Morris <rgm@gnu.org>
Wed, 13 Jul 2011 17:34:31 +0000 (13:34 -0400)
committerGlenn Morris <rgm@gnu.org>
Wed, 13 Jul 2011 17:34:31 +0000 (13:34 -0400)
* 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.

lisp/ChangeLog
lisp/dired.el

index c5eb9f9..22f5d30 100644 (file)
@@ -1,3 +1,9 @@
+2011-07-13  Glenn Morris  <rgm@gnu.org>
+
+       * 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  <larsi@gnus.org>
 
        * simple.el (toggle-truncate-lines): Clarify what is toggled
index 96709ff..3606e3d 100644 (file)
@@ -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)))