diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2009-11-24 10:25:54 +0000 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2009-11-24 10:25:54 +0000 |
commit | 605a20a98823768578d6faed5f04cb00e57da2bb (patch) | |
tree | 525322a2fc9fbabb9d8bebc014e51d061aeff7c2 /lisp/eshell/esh-util.el | |
parent | 937e60c88bfbbc44d44806a7cf43d5f982a8026f (diff) | |
download | emacs-605a20a98823768578d6faed5f04cb00e57da2bb.tar.gz |
Improve handling of processes on remote hosts.
* eshell/esh-util.el (eshell-path-env): New defvar.
(eshell-parse-colon-path): New defun.
(eshell-file-attributes): Use `eshell-parse-colon-path'.
* eshell/esh-ext.el (eshell-search-path): Use
`eshell-parse-colon-path'.
(eshell-remote-command): Remove argument HANDLER.
(eshell-external-command): Check for FTP remote connection.
* eshell/esh-proc.el (eshell-gather-process-output): Use
`file-truename', in order to start also symlinked files. Apply
`start-file-process' instead of `start-process'. Shorten `command'
to the local file name part.
* eshell/em-cmpl.el (eshell-complete-commands-list): Use
`eshell-parse-colon-path'.
* eshell/em-unix.el (eshell/du): Check for FTP remote connection.
* net/tramp.el (tramp-eshell-directory-change): New defun. Add it
to `eshell-directory-change-hook'.
Diffstat (limited to 'lisp/eshell/esh-util.el')
-rw-r--r-- | lisp/eshell/esh-util.el | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el index 4c5ecb4617a..37802a412b5 100644 --- a/lisp/eshell/esh-util.el +++ b/lisp/eshell/esh-util.el @@ -237,6 +237,21 @@ If N or M is nil, it means the end of the list." a (last a))) a)) +(defvar eshell-path-env (getenv "PATH") + "Content of $PATH. +It might be different from \(getenv \"PATH\"\), when +`default-directory' points to a remote host.") + +(defun eshell-parse-colon-path (path-env) + "Split string with `parse-colon-path'. +Prepend remote identification of `default-directory', if any." + (let ((remote (file-remote-p default-directory))) + (if remote + (mapcar + (lambda (x) (concat remote x)) + (parse-colon-path path-env)) + (parse-colon-path path-env)))) + (defun eshell-split-path (path) "Split a path into multiple subparts." (let ((len (length path)) @@ -682,29 +697,24 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable. (defun eshell-file-attributes (file) "Return the attributes of FILE, playing tricks if it's over ange-ftp." (let* ((file (expand-file-name file)) - (handler (find-file-name-handler file 'file-attributes)) entry) - (if (not handler) - (file-attributes file) - (if (eq (find-file-name-handler (file-name-directory file) - 'directory-files) - 'ange-ftp-hook-function) - (let ((base (file-name-nondirectory file)) - (dir (file-name-directory file))) + (if (string-equal (file-remote-p file 'method) "ftp") + (let ((base (file-name-nondirectory file)) + (dir (file-name-directory file))) + (if (boundp 'ange-cache) + (setq entry (cdr (assoc base (cdr (assoc dir ange-cache)))))) + (unless entry + (setq entry (eshell-parse-ange-ls dir)) (if (boundp 'ange-cache) - (setq entry (cdr (assoc base (cdr (assoc dir ange-cache)))))) - (unless entry - (setq entry (eshell-parse-ange-ls dir)) - (if (boundp 'ange-cache) - (setq ange-cache - (cons (cons dir entry) - ange-cache))) - (if entry - (let ((fentry (assoc base (cdr entry)))) - (if fentry - (setq entry (cdr fentry)) - (setq entry nil))))))) - (or entry (funcall handler 'file-attributes file))))) + (setq ange-cache + (cons (cons dir entry) + ange-cache))) + (if entry + (let ((fentry (assoc base (cdr entry)))) + (if fentry + (setq entry (cdr fentry)) + (setq entry nil)))))) + (file-attributes file)))) (defalias 'eshell-copy-tree 'copy-tree) |