emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109104: * eshell/em-ls.el (eshell/ls


From: Michael Albinus
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109104: * eshell/em-ls.el (eshell/ls): Use `apply'.
Date: Mon, 16 Jul 2012 13:42:01 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109104
committer: Michael Albinus <address@hidden>
branch nick: trunk
timestamp: Mon 2012-07-16 13:42:01 +0200
message:
  * 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.
modified:
  lisp/ChangeLog
  lisp/eshell/em-ls.el
  lisp/eshell/em-unix.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-07-16 10:19:56 +0000
+++ b/lisp/ChangeLog    2012-07-16 11:42:01 +0000
@@ -1,5 +1,10 @@
 2012-07-16  Michael Albinus  <address@hidden>
 
+       * 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.
+
        * vc/ediff.el (ediff-directories): Add trailing space to prompts.
 
        * vc/ediff-diff.el (ediff-same-file-contents): Handle the case,

=== modified file 'lisp/eshell/em-ls.el'
--- a/lisp/eshell/em-ls.el      2012-07-11 23:13:41 +0000
+++ b/lisp/eshell/em-ls.el      2012-07-16 11:42:01 +0000
@@ -312,7 +312,7 @@
   (let ((insert-func 'eshell-buffered-print)
        (error-func 'eshell-error)
        (flush-func 'eshell-flush))
-    (eshell-do-ls args)))
+    (apply 'eshell-do-ls args)))
 
 (put 'eshell/ls 'eshell-no-numeric-conversions t)
 

=== modified file 'lisp/eshell/em-unix.el'
--- a/lisp/eshell/em-unix.el    2012-06-27 07:08:06 +0000
+++ b/lisp/eshell/em-unix.el    2012-07-16 11:42:01 +0000
@@ -1037,12 +1037,8 @@
 
 (put 'eshell/occur 'eshell-no-numeric-conversions t)
 
-;; Pacify the byte-compiler.
-(defvar tramp-default-proxies-alist)
-
 (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
@@ -1057,29 +1053,29 @@
                  (host (or (file-remote-p default-directory 'host)
                            "localhost"))
                  (dir (or (file-remote-p default-directory 'localname)
-                          (expand-file-name default-directory))))
+                          (expand-file-name default-directory)))
+                 (prefix (file-remote-p default-directory)))
              (dolist (arg args)
                (if (string-equal arg "-") (setq login t) (setq user arg)))
              ;; `eshell-eval-using-options' does not handle "-".
              (if (member "-" orig-args) (setq login t))
              (if login (setq dir "~/"))
-             (if (and (file-remote-p default-directory)
+             (if (and prefix
                       (or
                        (not (string-equal
                              "su" (file-remote-p default-directory 'method)))
                        (not (string-equal
                              user (file-remote-p default-directory 'user)))))
-                 (add-to-list
-                  'tramp-default-proxies-alist
-                  (list host user (file-remote-p default-directory))))
-             (eshell-parse-command
-              "cd" (list (format "/su:address@hidden:%s" user host dir))))))))
+                 (eshell-parse-command
+                  "cd" (list (format "%s|su:address@hidden:%s"
+                                     (substring prefix 0 -1) user host dir)))
+               (eshell-parse-command
+                "cd" (list (format "/su:address@hidden:%s" user host 
dir)))))))))
 
 (put 'eshell/su 'eshell-no-numeric-conversions t)
 
 (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
@@ -1094,21 +1090,26 @@
                  (host (or (file-remote-p default-directory 'host)
                            "localhost"))
                  (dir (or (file-remote-p default-directory 'localname)
-                          (expand-file-name default-directory))))
+                          (expand-file-name default-directory)))
+                 (prefix (file-remote-p default-directory)))
              ;; `eshell-eval-using-options' reads options of COMMAND.
              (while (and (stringp (car orig-args))
                          (member (car orig-args) '("-u" "--user")))
                (setq orig-args (cddr orig-args)))
-             (if (and (file-remote-p default-directory)
-                      (or
-                       (not (string-equal
-                             "sudo" (file-remote-p default-directory 'method)))
-                       (not (string-equal
-                             user (file-remote-p default-directory 'user)))))
-                 (add-to-list
-                  'tramp-default-proxies-alist
-                  (list host user (file-remote-p default-directory))))
-             (let ((default-directory (format "/sudo:address@hidden:%s" user 
host dir)))
+             (let ((default-directory
+                     (if (and prefix
+                              (or
+                               (not
+                                (string-equal
+                                 "sudo"
+                                 (file-remote-p default-directory 'method)))
+                               (not
+                                (string-equal
+                                 user
+                                 (file-remote-p default-directory 'user)))))
+                         (format "%s|sudo:address@hidden:%s"
+                                 (substring prefix 0 -1) user host dir)
+                       (format "/sudo:address@hidden:%s" user host dir))))
                (eshell-named-command (car orig-args) (cdr orig-args))))))))
 
 (put 'eshell/sudo 'eshell-no-numeric-conversions t)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]