diff --git a/lisp/dired.el b/lisp/dired.el index f2a75df6ef1..c51e5e42c29 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -1710,9 +1710,10 @@ dired-insert-directory (cond ((and dir-wildcard (files--use-insert-directory-program-p)) (setq switches (concat "-d " switches)) (let* ((default-directory (car dir-wildcard)) + (ls (or (and remotep "ls") + insert-directory-program)) (script (format "%s %s %s" - insert-directory-program - switches (cdr dir-wildcard))) + ls switches (cdr dir-wildcard))) (sh (or (and remotep "/bin/sh") (executable-find shell-file-name) (executable-find "sh")))