summaryrefslogtreecommitdiff
path: root/lisp/shell.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2011-03-14 10:53:13 +0100
committerMichael Albinus <michael.albinus@gmx.de>2011-03-14 10:53:13 +0100
commit77c992bc5065ade7f460fa6f966f6b3e6aaa97fa (patch)
treea602471112c3c68c3f456287a0beb620cf56d226 /lisp/shell.el
parentcffc6f3bd9b5dbb9825502928bd9dd58ddbac02e (diff)
downloademacs-77c992bc5065ade7f460fa6f966f6b3e6aaa97fa.tar.gz
* shell.el (shell): When called interactively, offer to change the
shell file name on remote hosts.
Diffstat (limited to 'lisp/shell.el')
-rw-r--r--lisp/shell.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/lisp/shell.el b/lisp/shell.el
index bceea990baf..dde81c6cb95 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -583,6 +583,21 @@ Otherwise, one argument `-i' is passed to the shell.
(get-buffer-create (or buffer "*shell*"))
;; If the current buffer is a dead shell buffer, use it.
(current-buffer)))
+
+ ;; On remote hosts, the local `shell-file-name' might be useless.
+ (if (and (interactive-p)
+ (file-remote-p default-directory)
+ (null explicit-shell-file-name)
+ (null (getenv "ESHELL")))
+ (with-current-buffer buffer
+ (set (make-local-variable 'explicit-shell-file-name)
+ (file-remote-p
+ (expand-file-name
+ (read-file-name
+ "Remote shell path: " default-directory shell-file-name
+ t shell-file-name))
+ 'localname))))
+
;; Pop to buffer, so that the buffer's window will be correctly set
;; when we call comint (so that comint sets the COLUMNS env var properly).
(pop-to-buffer buffer)