diff options
| author | Michael Albinus | 2023-06-27 12:46:49 +0200 |
|---|---|---|
| committer | Michael Albinus | 2023-06-27 12:46:49 +0200 |
| commit | eca7394bdf2f57632238b2cf66c996b43cca2aef (patch) | |
| tree | cd3f3558c095f8a6d958d404e56b6af48df2027b | |
| parent | 3a50773ab0071addba98249d26c309f5fb78bd74 (diff) | |
| download | emacs-eca7394bdf2f57632238b2cf66c996b43cca2aef.tar.gz emacs-eca7394bdf2f57632238b2cf66c996b43cca2aef.zip | |
Fix dired-insert-directory wrt remote directories
* lisp/dired.el (dired-insert-directory): Respect remote
directories consequently.
| -rw-r--r-- | lisp/dired.el | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lisp/dired.el b/lisp/dired.el index 914d0a0e783..b4cfaa1842f 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -1632,6 +1632,7 @@ In other cases, DIR should be a directory name or a directory filename. | |||
| 1632 | If HDR is non-nil, insert a header line with the directory name." | 1632 | If HDR is non-nil, insert a header line with the directory name." |
| 1633 | (let ((opoint (point)) | 1633 | (let ((opoint (point)) |
| 1634 | (process-environment (copy-sequence process-environment)) | 1634 | (process-environment (copy-sequence process-environment)) |
| 1635 | (remotep (file-remote-p dir)) | ||
| 1635 | end) | 1636 | end) |
| 1636 | (if (and | 1637 | (if (and |
| 1637 | ;; Don't try to invoke `ls' if we are on DOS/Windows where | 1638 | ;; 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." | |||
| 1641 | (null ls-lisp-use-insert-directory-program))) | 1642 | (null ls-lisp-use-insert-directory-program))) |
| 1642 | ;; FIXME: Big ugly hack for Eshell's eshell-ls-use-in-dired. | 1643 | ;; FIXME: Big ugly hack for Eshell's eshell-ls-use-in-dired. |
| 1643 | (not (bound-and-true-p eshell-ls-use-in-dired)) | 1644 | (not (bound-and-true-p eshell-ls-use-in-dired)) |
| 1644 | (or (file-remote-p dir) | 1645 | (or remotep |
| 1645 | (if (eq dired-use-ls-dired 'unspecified) | 1646 | (if (eq dired-use-ls-dired 'unspecified) |
| 1646 | ;; Check whether "ls --dired" gives exit code 0, and | 1647 | ;; Check whether "ls --dired" gives exit code 0, and |
| 1647 | ;; save the answer in `dired-use-ls-dired'. | 1648 | ;; save the answer in `dired-use-ls-dired'. |
| @@ -1656,19 +1657,14 @@ see `dired-use-ls-dired' for more details.") | |||
| 1656 | ;; Use -N with --dired, to countermand possible non-default | 1657 | ;; Use -N with --dired, to countermand possible non-default |
| 1657 | ;; quoting style, in particular via the environment variable | 1658 | ;; quoting style, in particular via the environment variable |
| 1658 | ;; QUOTING_STYLE. | 1659 | ;; QUOTING_STYLE. |
| 1659 | (setq switches (concat "--dired -N " switches))) | 1660 | (unless remotep |
| 1661 | (setq switches (concat "--dired -N " switches)))) | ||
| 1660 | ;; Expand directory wildcards and fill file-list. | 1662 | ;; Expand directory wildcards and fill file-list. |
| 1661 | (let ((dir-wildcard (insert-directory-wildcard-in-dir-p dir))) | 1663 | (let ((dir-wildcard (insert-directory-wildcard-in-dir-p dir))) |
| 1662 | (cond (dir-wildcard | 1664 | (cond (dir-wildcard |
| 1663 | (setq switches (concat "-d " switches)) | 1665 | (setq switches (concat "-d " switches)) |
| 1664 | ;; We don't know whether the remote ls supports | ||
| 1665 | ;; "--dired", so we cannot add it to the `process-file' | ||
| 1666 | ;; call for wildcards. | ||
| 1667 | (when (file-remote-p dir) | ||
| 1668 | (setq switches (string-replace "--dired -N" "" switches))) | ||
| 1669 | (let* ((default-directory (car dir-wildcard)) | 1666 | (let* ((default-directory (car dir-wildcard)) |
| 1670 | (script (format "ls %s %s" switches (cdr dir-wildcard))) | 1667 | (script (format "ls %s %s" switches (cdr dir-wildcard))) |
| 1671 | (remotep (file-remote-p dir)) | ||
| 1672 | (sh (or (and remotep "/bin/sh") | 1668 | (sh (or (and remotep "/bin/sh") |
| 1673 | (executable-find shell-file-name) | 1669 | (executable-find shell-file-name) |
| 1674 | (executable-find "sh"))) | 1670 | (executable-find "sh"))) |