aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/shell.el
diff options
context:
space:
mode:
authorMichael Albinus2017-04-02 11:02:54 +0200
committerMichael Albinus2017-04-02 11:02:54 +0200
commit59191cd0cbe8463f9095a71cb4048bb138d6e446 (patch)
treeea0e063deb25c07c6e315b02d3db427e25e917b8 /lisp/shell.el
parent21918f4e1c5939038c7e8d0b8b8e8a647c086796 (diff)
downloademacs-59191cd0cbe8463f9095a71cb4048bb138d6e446.tar.gz
emacs-59191cd0cbe8463f9095a71cb4048bb138d6e446.zip
Apply connecion-local variables for shells
* doc/misc/tramp.texi (Remote processes): Show use of connection-local variables. Don't mention Emacs 23 anymore. (Frequently Asked Questions): Precise Emacs and MS Windows version. * lisp/files-x.el (connection-local-normalize-criteria): Suppress nil properties. (connection-local-set-profiles, with-connection-local-profiles): Adapt docstring. * lisp/shell.el (shell): Apply connecion-local variables.
Diffstat (limited to 'lisp/shell.el')
-rw-r--r--lisp/shell.el67
1 files changed, 37 insertions, 30 deletions
diff --git a/lisp/shell.el b/lisp/shell.el
index c8a8555d632..55a053295fa 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -711,36 +711,43 @@ Otherwise, one argument `-i' is passed to the shell.
711 ;; If the current buffer is a dead shell buffer, use it. 711 ;; If the current buffer is a dead shell buffer, use it.
712 (current-buffer))) 712 (current-buffer)))
713 713
714 ;; On remote hosts, the local `shell-file-name' might be useless. 714 (with-current-buffer buffer
715 (if (and (called-interactively-p 'any) 715 (when (file-remote-p default-directory)
716 (file-remote-p default-directory) 716 ;; Apply connection-local variables.
717 (null explicit-shell-file-name) 717 (hack-connection-local-variables-apply
718 (null (getenv "ESHELL"))) 718 `(:application 'tramp
719 (with-current-buffer buffer 719 :protocol ,(file-remote-p default-directory 'method)
720 (set (make-local-variable 'explicit-shell-file-name) 720 :user ,(file-remote-p default-directory 'user)
721 (expand-file-name 721 :machine ,(file-remote-p default-directory 'host)))
722 (file-local-name 722
723 (read-file-name 723 ;; On remote hosts, the local `shell-file-name' might be useless.
724 "Remote shell path: " default-directory shell-file-name 724 (if (and (called-interactively-p 'any)
725 t shell-file-name)))))) 725 (null explicit-shell-file-name)
726 726 (null (getenv "ESHELL")))
727 ;; The buffer's window must be correctly set when we call comint (so 727 (set (make-local-variable 'explicit-shell-file-name)
728 ;; that comint sets the COLUMNS env var properly). 728 (expand-file-name
729 (pop-to-buffer buffer) 729 (file-local-name
730 (unless (comint-check-proc buffer) 730 (read-file-name
731 (let* ((prog (or explicit-shell-file-name 731 "Remote shell path: " default-directory shell-file-name
732 (getenv "ESHELL") shell-file-name)) 732 t shell-file-name))))))
733 (name (file-name-nondirectory prog)) 733
734 (startfile (concat "~/.emacs_" name)) 734 ;; The buffer's window must be correctly set when we call comint
735 (xargs-name (intern-soft (concat "explicit-" name "-args")))) 735 ;; (so that comint sets the COLUMNS env var properly).
736 (unless (file-exists-p startfile) 736 (pop-to-buffer buffer)
737 (setq startfile (concat user-emacs-directory "init_" name ".sh"))) 737 (unless (comint-check-proc buffer)
738 (apply 'make-comint-in-buffer "shell" buffer prog 738 (let* ((prog (or explicit-shell-file-name
739 (if (file-exists-p startfile) startfile) 739 (getenv "ESHELL") shell-file-name))
740 (if (and xargs-name (boundp xargs-name)) 740 (name (file-name-nondirectory prog))
741 (symbol-value xargs-name) 741 (startfile (concat "~/.emacs_" name))
742 '("-i"))) 742 (xargs-name (intern-soft (concat "explicit-" name "-args"))))
743 (shell-mode))) 743 (unless (file-exists-p startfile)
744 (setq startfile (concat user-emacs-directory "init_" name ".sh")))
745 (apply 'make-comint-in-buffer "shell" buffer prog
746 (if (file-exists-p startfile) startfile)
747 (if (and xargs-name (boundp xargs-name))
748 (symbol-value xargs-name)
749 '("-i")))
750 (shell-mode))))
744 buffer) 751 buffer)
745 752
746;;; Directory tracking 753;;; Directory tracking