diff options
| author | Tino Calancha | 2017-08-02 16:50:37 +0900 |
|---|---|---|
| committer | Tino Calancha | 2017-08-02 16:50:44 +0900 |
| commit | e82c4f56e6f9a6bce4098698b17fa45dcc5bbd25 (patch) | |
| tree | fd64a6e00aea2d02f64405964938c4ad90eac7dd | |
| parent | a79671c97fb193ec44ca27e1eeb9e7f5bcf2e9f6 (diff) | |
| download | emacs-e82c4f56e6f9a6bce4098698b17fa45dcc5bbd25.tar.gz emacs-e82c4f56e6f9a6bce4098698b17fa45dcc5bbd25.zip | |
Don't assume /bin/sh as the 'sh' location in the local host
* lisp/dired.el (dired-insert-directory): Use executable-find in
a local host.
| -rw-r--r-- | lisp/dired.el | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/dired.el b/lisp/dired.el index 4f8f615a34b..e1bedb6c73f 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -1276,12 +1276,17 @@ see `dired-use-ls-dired' for more details.") | |||
| 1276 | ;; call for wildcards. | 1276 | ;; call for wildcards. |
| 1277 | (when (file-remote-p dir) | 1277 | (when (file-remote-p dir) |
| 1278 | (setq switches (dired-replace-in-string "--dired" "" switches))) | 1278 | (setq switches (dired-replace-in-string "--dired" "" switches))) |
| 1279 | (let ((default-directory (car dir-wildcard)) | 1279 | (let* ((default-directory (car dir-wildcard)) |
| 1280 | (script (format "ls %s %s" switches (cdr dir-wildcard)))) | 1280 | (script (format "ls %s %s" switches (cdr dir-wildcard))) |
| 1281 | (remotep (file-remote-p dir)) | ||
| 1282 | (sh (or (and remotep "/bin/sh") | ||
| 1283 | (and (bound-and-true-p explicit-shell-file-name) | ||
| 1284 | (executable-find explicit-shell-file-name)) | ||
| 1285 | (executable-find "sh"))) | ||
| 1286 | (switch (if remotep "-c" shell-command-switch))) | ||
| 1281 | (unless | 1287 | (unless |
| 1282 | (zerop | 1288 | (zerop |
| 1283 | (process-file | 1289 | (process-file sh nil (current-buffer) nil switch script)) |
| 1284 | "/bin/sh" nil (current-buffer) nil "-c" script)) | ||
| 1285 | (user-error | 1290 | (user-error |
| 1286 | "%s: No files matching wildcard" (cdr dir-wildcard))) | 1291 | "%s: No files matching wildcard" (cdr dir-wildcard))) |
| 1287 | (insert-directory-clean (point) switches))) | 1292 | (insert-directory-clean (point) switches))) |