]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix Dired on DOS/Windows.
authorEli Zaretskii <eliz@gnu.org>
Wed, 2 Feb 2011 16:21:52 +0000 (18:21 +0200)
committerEli Zaretskii <eliz@gnu.org>
Wed, 2 Feb 2011 16:21:52 +0000 (18:21 +0200)
 dired.el (dired-insert-directory): Don't invoke `ls' when
 ls-lisp.el is used to emulate it.

lisp/ChangeLog
lisp/dired.el

index 627c61deaeb272ec44b11e97971bf7aebdfcbbfd..219aef943debedd6cbdba1ea883967e1535616bf 100644 (file)
@@ -1,3 +1,8 @@
+2011-02-02  Eli Zaretskii  <eliz@gnu.org>
+
+       * dired.el (dired-insert-directory): Don't invoke `ls' when
+       ls-lisp.el is used to emulate it.
+
 2011-02-01  Julien Danjou  <julien@danjou.info>
 
        * color.el (color-gradient): Add a color-gradient function.
index 3cc490f12c7a363e2aaa3e6748698e50a721fe3e..3a76398e956b5fbac30cc4fa3bbe0be5c2d528b3 100644 (file)
@@ -1052,6 +1052,8 @@ BEG..END is the line where the file info is located."
        (set-marker file nil)))))
 
 
+(defvar ls-lisp-use-insert-directory-program)
+
 (defun dired-insert-directory (dir switches &optional file-list wildcard hdr)
   "Insert a directory listing of DIR, Dired style.
 Use SWITCHES to make the listings.
@@ -1063,14 +1065,20 @@ If HDR is non-nil, insert a header line with the directory name."
   (let ((opoint (point))
        (process-environment (copy-sequence process-environment))
        end)
-    (if (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))
-             dired-use-ls-dired)
-           (file-remote-p dir))
+    (if (and
+        ;; Don't try to invoke `ls' if we are on DOS/Windows where
+        ;; ls-lisp emulation is used, except if they want to use `ls'
+        ;; as indicated by `ls-lisp-use-insert-directory-program'.
+        (not (and (featurep 'ls-lisp)
+                  (null ls-lisp-use-insert-directory-program)))
+        (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))
+              dired-use-ls-dired)
+            (file-remote-p dir)))
        (setq switches (concat "--dired " switches)))
     ;; We used to specify the C locale here, to force English month names;
     ;; but this should not be necessary any more,