]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix dired-insert-directory wrt remote directories
authorMichael Albinus <michael.albinus@gmx.de>
Tue, 27 Jun 2023 10:46:49 +0000 (12:46 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Tue, 27 Jun 2023 10:46:49 +0000 (12:46 +0200)
* lisp/dired.el (dired-insert-directory): Respect remote
directories consequently.

lisp/dired.el

index 914d0a0e7839fb32e4b2b4ab6c0acbdc9449b915..b4cfaa1842f6f3082f2da4969e938f9c18015ada 100644 (file)
@@ -1632,6 +1632,7 @@ In other cases, DIR should be a directory name or a directory filename.
 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
@@ -1641,7 +1642,7 @@ If HDR is non-nil, insert a header line with the directory name."
                   (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'.
@@ -1656,19 +1657,14 @@ see `dired-use-ls-dired' for more details.")
         ;; 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")))