If HDR is non-nil, insert a header line with the directory name."
(let ((opoint (point))
(process-environment (copy-sequence process-environment))
+ (remotep (file-remote-p dir))
end)
(if (and
;; Don't try to invoke `ls' if we are on DOS/Windows where
(null ls-lisp-use-insert-directory-program)))
;; FIXME: Big ugly hack for Eshell's eshell-ls-use-in-dired.
(not (bound-and-true-p eshell-ls-use-in-dired))
- (or (file-remote-p dir)
+ (or remotep
(if (eq dired-use-ls-dired 'unspecified)
;; Check whether "ls --dired" gives exit code 0, and
;; save the answer in `dired-use-ls-dired'.
;; Use -N with --dired, to countermand possible non-default
;; quoting style, in particular via the environment variable
;; QUOTING_STYLE.
- (setq switches (concat "--dired -N " switches)))
+ (unless remotep
+ (setq switches (concat "--dired -N " switches))))
;; Expand directory wildcards and fill file-list.
(let ((dir-wildcard (insert-directory-wildcard-in-dir-p dir)))
(cond (dir-wildcard
(setq switches (concat "-d " switches))
- ;; We don't know whether the remote ls supports
- ;; "--dired", so we cannot add it to the `process-file'
- ;; call for wildcards.
- (when (file-remote-p dir)
- (setq switches (string-replace "--dired -N" "" switches)))
(let* ((default-directory (car dir-wildcard))
(script (format "ls %s %s" switches (cdr dir-wildcard)))
- (remotep (file-remote-p dir))
(sh (or (and remotep "/bin/sh")
(executable-find shell-file-name)
(executable-find "sh")))