summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2011-02-02 18:21:52 +0200
committerEli Zaretskii <eliz@gnu.org>2011-02-02 18:21:52 +0200
commitbc35ff325b150d01e6858358e625dcdb6374fb37 (patch)
treec0f53571c03b82b90a803a04401c0db73b786189
parentaa2d499cd626a2e2f6e131cbbf8127c34c77a8d9 (diff)
downloademacs-bc35ff325b150d01e6858358e625dcdb6374fb37.tar.gz
Fix Dired on DOS/Windows.
dired.el (dired-insert-directory): Don't invoke `ls' when ls-lisp.el is used to emulate it.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/dired.el24
2 files changed, 21 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 627c61deaeb..219aef943de 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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.
diff --git a/lisp/dired.el b/lisp/dired.el
index 3cc490f12c7..3a76398e956 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -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,