summaryrefslogtreecommitdiff
path: root/lisp/eshell/em-unix.el
diff options
context:
space:
mode:
authorAidan Gauland <aidalgol@no8wireless.co.nz>2013-03-27 11:08:58 +1300
committerAidan Gauland <aidalgol@no8wireless.co.nz>2013-03-27 11:08:58 +1300
commit15e4ed9c6a6fd9b5cc587a7318e7b82389ca1b56 (patch)
tree27ad564a66f2e2d79694e3ddddce9602d04e3566 /lisp/eshell/em-unix.el
parentc6e72e1739cfff4f713fdbb8369ce89341ad9a6b (diff)
downloademacs-15e4ed9c6a6fd9b5cc587a7318e7b82389ca1b56.tar.gz
Added eshell-tramp module
* lisp/eshell/em-unix.el: Moved su and sudo to... * lisp/eshell/em-tramp.el: ...Eshell tramp module * doc/misc/eshell.texi: Updated manual to reflect changes. External su and sudo commands are now the default; the internal, TRAMP-using variants can still be used by enabling the eshell-tramp module.
Diffstat (limited to 'lisp/eshell/em-unix.el')
-rw-r--r--lisp/eshell/em-unix.el81
1 files changed, 1 insertions, 80 deletions
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index 94508d71592..60caf38710a 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -148,7 +148,7 @@ Otherwise, Emacs will attempt to use rsh to invoke du on the remote machine."
(make-local-variable 'eshell-complex-commands)
(setq eshell-complex-commands
(append '("grep" "egrep" "fgrep" "agrep" "glimpse" "locate"
- "cat" "time" "cp" "mv" "make" "du" "diff" "su" "sudo")
+ "cat" "time" "cp" "mv" "make" "du" "diff")
eshell-complex-commands)))
(defalias 'eshell/date 'current-time-string)
@@ -1038,85 +1038,6 @@ Show wall-clock time elapsed during execution of COMMAND.")
(put 'eshell/occur 'eshell-no-numeric-conversions t)
-(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
- "su" args
- '((?h "help" nil nil "show this usage screen")
- (?l "login" nil login "provide a login environment")
- (? nil nil login "provide a login environment")
- :usage "[- | -l | --login] [USER]
-Become another USER during a login session.")
- (throw 'eshell-replace-command
- (let ((user "root")
- (host (or (file-remote-p default-directory 'host)
- "localhost"))
- (dir (or (file-remote-p default-directory 'localname)
- (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 prefix
- (or
- (not (string-equal
- "su" (file-remote-p default-directory 'method)))
- (not (string-equal
- user (file-remote-p default-directory 'user)))))
- (eshell-parse-command
- "cd" (list (format "%s|su:%s@%s:%s"
- (substring prefix 0 -1) user host dir)))
- (eshell-parse-command
- "cd" (list (format "/su:%s@%s:%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
- "sudo" args
- '((?h "help" nil nil "show this usage screen")
- (?u "user" t user "execute a command as another USER")
- :show-usage
- :usage "[(-u | --user) USER] COMMAND
-Execute a COMMAND as the superuser or another USER.")
- (throw 'eshell-external
- (let ((user (or user "root"))
- (host (or (file-remote-p default-directory 'host)
- "localhost"))
- (dir (or (file-remote-p default-directory 'localname)
- (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)))
- (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:%s@%s:%s"
- (substring prefix 0 -1) user host dir)
- (format "/sudo:%s@%s:%s" user host dir))))
- (eshell-named-command (car orig-args) (cdr orig-args))))))))
-
-(put 'eshell/sudo 'eshell-no-numeric-conversions t)
-
(provide 'em-unix)
;; Local Variables: