From c9bcc580e8286ee32840dae5aacdcc930cfee2da Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 18 Feb 2013 20:13:21 +0100 Subject: [PATCH] * eshell/em-unix.el (eshell/su): Require tramp. (eshell/sudo): Require tramp. Remove now unnecessary check. * net/tramp-sh.el (tramp-sh-handle-start-file-process): Let-bind `tramp-current-connection' in order to avoid an error when several commands are invoked in a short time in eshell and friends. --- lisp/ChangeLog | 9 +++++++++ lisp/eshell/em-unix.el | 4 ++-- lisp/net/tramp-sh.el | 6 +++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 735ddd25369..7d7e62e8141 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2013-02-18 Michael Albinus + + * eshell/em-unix.el (eshell/su): Require tramp. + (eshell/sudo): Require tramp. Remove now unnecessary check. + + * net/tramp-sh.el (tramp-sh-handle-start-file-process): Let-bind + `tramp-current-connection' in order to avoid an error when several + commands are invoked in a short time in eshell and friends. + 2013-02-16 Didier Verna * net/network-stream.el (network-stream-open-starttls): diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index 9e061b64504..b387a8ba974 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el @@ -1039,6 +1039,7 @@ Show wall-clock time elapsed during execution of COMMAND.") (defun eshell/su (&rest args) "Alias \"su\" to call Tramp." + (require 'tramp) (setq args (eshell-stringify-list (eshell-flatten-list args))) (let ((orig-args (copy-tree args))) (eshell-eval-using-options @@ -1076,6 +1077,7 @@ Become another USER during a login session.") (defun eshell/sudo (&rest args) "Alias \"sudo\" to call Tramp." + (require 'tramp) (setq args (eshell-stringify-list (eshell-flatten-list args))) (let ((orig-args (copy-tree args))) (eshell-eval-using-options @@ -1110,8 +1112,6 @@ Execute a COMMAND as the superuser or another USER.") (format "%s|sudo:%s@%s:%s" (substring prefix 0 -1) user host dir) (format "/sudo:%s@%s:%s" user host dir)))) - ;; Ensure, that Tramp has connected to that construct already. - (ignore (file-exists-p default-directory)) (eshell-named-command (car orig-args) (cdr orig-args)))))))) (put 'eshell/sudo 'eshell-no-numeric-conversions t) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 2152ba1e270..29a6344734f 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2739,7 +2739,11 @@ the result will be a local, non-Tramp, filename." (or (null program) tramp-process-connection-type)) (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) (name1 name) - (i 0)) + (i 0) + ;; We do not want to raise an error when + ;; `start-file-process' has been started several time in + ;; `eshell' and friends. + (tramp-current-connection nil)) (unless buffer ;; BUFFER can be nil. We use a temporary buffer. -- 2.39.5