Mercurial > emacs
diff lisp/eshell/esh-util.el @ 106219:16b061d2742d
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'.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Tue, 24 Nov 2009 10:25:54 +0000 |
parents | d2c2e1206e31 |
children | badff1777919 |
line wrap: on
line diff
--- a/lisp/eshell/esh-util.el Tue Nov 24 09:19:09 2009 +0000 +++ b/lisp/eshell/esh-util.el Tue Nov 24 10:25:54 2009 +0000 @@ -237,6 +237,21 @@ 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 @@ (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)