Support zsh as local shell in Tramp (Bug#31924)

* lisp/net/tramp-sh.el (tramp-sh-extra-args): Extend zsh
arguments.  Add :version.
(tramp-maybe-open-connection): Use extra args for
`tramp-encoding-shell'.  (Bug#31924)
This commit is contained in:
Michael Albinus 2019-10-09 12:58:43 +02:00
parent 76a9f03ca6
commit 0691fdc410

View file

@ -537,7 +537,7 @@ based on the Tramp and Emacs versions, and should not be set here."
;;;###tramp-autoload
(defcustom tramp-sh-extra-args
'(("/bash\\'" . "-norc -noprofile")
("/zsh\\'" . "-f +Z"))
("/zsh\\'" . "-f +Z -V"))
"Alist specifying extra arguments to pass to the remote shell.
Entries are (REGEXP . ARGS) where REGEXP is a regular expression
matching the shell file name and ARGS is a string specifying the
@ -547,6 +547,7 @@ This variable is only used when Tramp needs to start up another shell
for tilde expansion. The extra arguments should typically prevent the
shell from reading its init file."
:group 'tramp
:version "27.1"
:type '(alist :key-type regexp :value-type string))
(defconst tramp-actions-before-shell
@ -4869,6 +4870,7 @@ connection if a previous connection has died for some reason."
;; W32 systems.
(process-coding-system-alist nil)
(coding-system-for-read nil)
(extra-args (tramp-get-sh-extra-args tramp-encoding-shell))
;; This must be done in order to avoid our file
;; name handler.
(p (let ((default-directory
@ -4877,10 +4879,11 @@ connection if a previous connection has died for some reason."
#'start-process
(tramp-get-connection-name vec)
(tramp-get-connection-buffer vec)
(if tramp-encoding-command-interactive
(list tramp-encoding-shell
tramp-encoding-command-interactive)
(list tramp-encoding-shell))))))
(append
(list tramp-encoding-shell)
(and tramp-encoding-command-interactive
(list tramp-encoding-command-interactive))
(and extra-args (split-string extra-args)))))))
;; Set sentinel and query flag. Initialize variables.
(set-process-sentinel p #'tramp-process-sentinel)