aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2012-07-16 13:42:01 +0200
committerMichael Albinus2012-07-16 13:42:01 +0200
commit9328d9aabae2f45f82b59aad5214a3f13ee1b2a1 (patch)
tree918a667537a03133a325cc8cc9e1f1b0128d1117
parent5d127af98d11f54f9c75e28dcd8c3e26e42d50a8 (diff)
downloademacs-9328d9aabae2f45f82b59aad5214a3f13ee1b2a1.tar.gz
emacs-9328d9aabae2f45f82b59aad5214a3f13ee1b2a1.zip
* eshell/em-ls.el (eshell/ls): Use `apply'.
* eshell/em-unix.el (eshell/su, eshell/sudo): Apply Tramp's ad-hoc multi-hops, instead of Tramp internals.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/eshell/em-ls.el2
-rw-r--r--lisp/eshell/em-unix.el47
3 files changed, 30 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 929c810ed71..90ab984d94d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
12012-07-16 Michael Albinus <michael.albinus@gmx.de> 12012-07-16 Michael Albinus <michael.albinus@gmx.de>
2 2
3 * eshell/em-ls.el (eshell/ls): Use `apply'.
4
5 * eshell/em-unix.el (eshell/su, eshell/sudo): Apply Tramp's ad-hoc
6 multi-hops, instead of Tramp internals.
7
3 * vc/ediff.el (ediff-directories): Add trailing space to prompts. 8 * vc/ediff.el (ediff-directories): Add trailing space to prompts.
4 9
5 * vc/ediff-diff.el (ediff-same-file-contents): Handle the case, 10 * vc/ediff-diff.el (ediff-same-file-contents): Handle the case,
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el
index 142a5f964ab..2dd92ba3530 100644
--- a/lisp/eshell/em-ls.el
+++ b/lisp/eshell/em-ls.el
@@ -312,7 +312,7 @@ instead."
312 (let ((insert-func 'eshell-buffered-print) 312 (let ((insert-func 'eshell-buffered-print)
313 (error-func 'eshell-error) 313 (error-func 'eshell-error)
314 (flush-func 'eshell-flush)) 314 (flush-func 'eshell-flush))
315 (eshell-do-ls args))) 315 (apply 'eshell-do-ls args)))
316 316
317(put 'eshell/ls 'eshell-no-numeric-conversions t) 317(put 'eshell/ls 'eshell-no-numeric-conversions t)
318 318
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index ddba5a6520a..35f7a0a9e3d 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -1037,12 +1037,8 @@ Show wall-clock time elapsed during execution of COMMAND.")
1037 1037
1038(put 'eshell/occur 'eshell-no-numeric-conversions t) 1038(put 'eshell/occur 'eshell-no-numeric-conversions t)
1039 1039
1040;; Pacify the byte-compiler.
1041(defvar tramp-default-proxies-alist)
1042
1043(defun eshell/su (&rest args) 1040(defun eshell/su (&rest args)
1044 "Alias \"su\" to call Tramp." 1041 "Alias \"su\" to call Tramp."
1045 (require 'tramp)
1046 (setq args (eshell-stringify-list (eshell-flatten-list args))) 1042 (setq args (eshell-stringify-list (eshell-flatten-list args)))
1047 (let ((orig-args (copy-tree args))) 1043 (let ((orig-args (copy-tree args)))
1048 (eshell-eval-using-options 1044 (eshell-eval-using-options
@@ -1057,29 +1053,29 @@ Become another USER during a login session.")
1057 (host (or (file-remote-p default-directory 'host) 1053 (host (or (file-remote-p default-directory 'host)
1058 "localhost")) 1054 "localhost"))
1059 (dir (or (file-remote-p default-directory 'localname) 1055 (dir (or (file-remote-p default-directory 'localname)
1060 (expand-file-name default-directory)))) 1056 (expand-file-name default-directory)))
1057 (prefix (file-remote-p default-directory)))
1061 (dolist (arg args) 1058 (dolist (arg args)
1062 (if (string-equal arg "-") (setq login t) (setq user arg))) 1059 (if (string-equal arg "-") (setq login t) (setq user arg)))
1063 ;; `eshell-eval-using-options' does not handle "-". 1060 ;; `eshell-eval-using-options' does not handle "-".
1064 (if (member "-" orig-args) (setq login t)) 1061 (if (member "-" orig-args) (setq login t))
1065 (if login (setq dir "~/")) 1062 (if login (setq dir "~/"))
1066 (if (and (file-remote-p default-directory) 1063 (if (and prefix
1067 (or 1064 (or
1068 (not (string-equal 1065 (not (string-equal
1069 "su" (file-remote-p default-directory 'method))) 1066 "su" (file-remote-p default-directory 'method)))
1070 (not (string-equal 1067 (not (string-equal
1071 user (file-remote-p default-directory 'user))))) 1068 user (file-remote-p default-directory 'user)))))
1072 (add-to-list 1069 (eshell-parse-command
1073 'tramp-default-proxies-alist 1070 "cd" (list (format "%s|su:%s@%s:%s"
1074 (list host user (file-remote-p default-directory)))) 1071 (substring prefix 0 -1) user host dir)))
1075 (eshell-parse-command 1072 (eshell-parse-command
1076 "cd" (list (format "/su:%s@%s:%s" user host dir)))))))) 1073 "cd" (list (format "/su:%s@%s:%s" user host dir)))))))))
1077 1074
1078(put 'eshell/su 'eshell-no-numeric-conversions t) 1075(put 'eshell/su 'eshell-no-numeric-conversions t)
1079 1076
1080(defun eshell/sudo (&rest args) 1077(defun eshell/sudo (&rest args)
1081 "Alias \"sudo\" to call Tramp." 1078 "Alias \"sudo\" to call Tramp."
1082 (require 'tramp)
1083 (setq args (eshell-stringify-list (eshell-flatten-list args))) 1079 (setq args (eshell-stringify-list (eshell-flatten-list args)))
1084 (let ((orig-args (copy-tree args))) 1080 (let ((orig-args (copy-tree args)))
1085 (eshell-eval-using-options 1081 (eshell-eval-using-options
@@ -1094,21 +1090,26 @@ Execute a COMMAND as the superuser or another USER.")
1094 (host (or (file-remote-p default-directory 'host) 1090 (host (or (file-remote-p default-directory 'host)
1095 "localhost")) 1091 "localhost"))
1096 (dir (or (file-remote-p default-directory 'localname) 1092 (dir (or (file-remote-p default-directory 'localname)
1097 (expand-file-name default-directory)))) 1093 (expand-file-name default-directory)))
1094 (prefix (file-remote-p default-directory)))
1098 ;; `eshell-eval-using-options' reads options of COMMAND. 1095 ;; `eshell-eval-using-options' reads options of COMMAND.
1099 (while (and (stringp (car orig-args)) 1096 (while (and (stringp (car orig-args))
1100 (member (car orig-args) '("-u" "--user"))) 1097 (member (car orig-args) '("-u" "--user")))
1101 (setq orig-args (cddr orig-args))) 1098 (setq orig-args (cddr orig-args)))
1102 (if (and (file-remote-p default-directory) 1099 (let ((default-directory
1103 (or 1100 (if (and prefix
1104 (not (string-equal 1101 (or
1105 "sudo" (file-remote-p default-directory 'method))) 1102 (not
1106 (not (string-equal 1103 (string-equal
1107 user (file-remote-p default-directory 'user))))) 1104 "sudo"
1108 (add-to-list 1105 (file-remote-p default-directory 'method)))
1109 'tramp-default-proxies-alist 1106 (not
1110 (list host user (file-remote-p default-directory)))) 1107 (string-equal
1111 (let ((default-directory (format "/sudo:%s@%s:%s" user host dir))) 1108 user
1109 (file-remote-p default-directory 'user)))))
1110 (format "%s|sudo:%s@%s:%s"
1111 (substring prefix 0 -1) user host dir)
1112 (format "/sudo:%s@%s:%s" user host dir))))
1112 (eshell-named-command (car orig-args) (cdr orig-args)))))))) 1113 (eshell-named-command (car orig-args) (cdr orig-args))))))))
1113 1114
1114(put 'eshell/sudo 'eshell-no-numeric-conversions t) 1115(put 'eshell/sudo 'eshell-no-numeric-conversions t)