emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp ChangeLog eshell/em-cmpl.el eshell/e...


From: Michael Albinus
Subject: [Emacs-diffs] emacs/lisp ChangeLog eshell/em-cmpl.el eshell/e...
Date: Tue, 24 Nov 2009 10:26:00 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Michael Albinus <albinus>       09/11/24 10:25:59

Modified files:
        lisp           : ChangeLog 
        lisp/eshell    : em-cmpl.el em-unix.el esh-ext.el esh-proc.el 
                         esh-util.el 
        lisp/net       : tramp.el 

Log message:
        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'.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16715&r2=1.16716
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/eshell/em-cmpl.el?cvsroot=emacs&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/eshell/em-unix.el?cvsroot=emacs&r1=1.45&r2=1.46
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/eshell/esh-ext.el?cvsroot=emacs&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/eshell/esh-proc.el?cvsroot=emacs&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/eshell/esh-util.el?cvsroot=emacs&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/net/tramp.el?cvsroot=emacs&r1=1.270&r2=1.271

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16715
retrieving revision 1.16716
diff -u -b -r1.16715 -r1.16716
--- ChangeLog   24 Nov 2009 07:47:45 -0000      1.16715
+++ ChangeLog   24 Nov 2009 10:25:54 -0000      1.16716
@@ -1,3 +1,29 @@
+2009-11-24  Michael Albinus  <address@hidden>
+
+       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'.
+
 2009-11-24  Tassilo Horn  <address@hidden>
 
        * doc-view.el (doc-view-mode): Switch off view-mode explicitly,

Index: eshell/em-cmpl.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/eshell/em-cmpl.el,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- eshell/em-cmpl.el   5 Jan 2009 03:21:43 -0000       1.29
+++ eshell/em-cmpl.el   24 Nov 2009 10:25:58 -0000      1.30
@@ -402,7 +402,7 @@
          (setq filename (substring filename 1)
                pcomplete-stub filename
                glob-name t))
-      (let* ((paths (split-string (getenv "PATH") path-separator))
+      (let* ((paths (eshell-parse-colon-path eshell-path-env))
             (cwd (file-name-as-directory
                   (expand-file-name default-directory)))
             (path "") (comps-in-path ())

Index: eshell/em-unix.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/eshell/em-unix.el,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- eshell/em-unix.el   3 Nov 2009 02:04:35 -0000       1.45
+++ eshell/em-unix.el   24 Nov 2009 10:25:58 -0000      1.46
@@ -859,9 +859,8 @@
     (if (and ext-du
             (not (catch 'have-ange-path
                    (eshell-for arg args
-                     (if (eq (find-file-name-handler (expand-file-name arg)
-                                                     'directory-files)
-                             'ange-ftp-hook-function)
+                     (if (string-equal
+                          (file-remote-p (expand-file-name arg) 'method) "ftp")
                          (throw 'have-ange-path t))))))
        (throw 'eshell-replace-command
               (eshell-parse-command ext-du args))

Index: eshell/esh-ext.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/eshell/esh-ext.el,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- eshell/esh-ext.el   3 Nov 2009 02:04:35 -0000       1.33
+++ eshell/esh-ext.el   24 Nov 2009 10:25:58 -0000      1.34
@@ -73,7 +73,7 @@
   "Search the environment path for NAME."
   (if (file-name-absolute-p name)
       name
-    (let ((list (parse-colon-path (getenv "PATH")))
+    (let ((list (eshell-parse-colon-path eshell-path-env))
          suffixes n1 n2 file)
       (while list
        (setq n1 (concat (car list) name))
@@ -176,7 +176,7 @@
        (error "%s: external command not found"
               (substring command 1))))))
 
-(defun eshell-remote-command (handler command args)
+(defun eshell-remote-command (command args)
   "Insert output from a remote COMMAND, using ARGS.
 A remote command is something that executes on a different machine.
 An external command simply means external to Emacs.
@@ -190,7 +190,7 @@
     (unwind-protect
        (progn
          (setq exitcode
-               (funcall handler 'shell-command
+               (shell-command
                         (mapconcat 'shell-quote-argument
                                    (append (list command) args) " ")
                         outbuf errbuf))
@@ -203,23 +203,14 @@
 (defun eshell-external-command (command args)
   "Insert output from an external COMMAND, using ARGS."
   (setq args (eshell-stringify-list (eshell-flatten-list args)))
-  (let ((handler
-        (unless (or (equal default-directory "/")
-                    (and (eshell-under-windows-p)
-                         (string-match "\\`[A-Za-z]:[/\\\\]\\'"
-                                       default-directory)))
-          (find-file-name-handler default-directory
-                                  'shell-command))))
-    (if (and handler
-            (not (and (featurep 'xemacs)
-                      (eq handler 'dired-handler-fn))))
-       (eshell-remote-command handler command args))
+  (if (string-equal (file-remote-p default-directory 'method) "ftp")
+      (eshell-remote-command command args))
     (let ((interp (eshell-find-interpreter command)))
       (assert interp)
       (if (functionp (car interp))
          (apply (car interp) (append (cdr interp) args))
        (eshell-gather-process-output
-        (car interp) (append (cdr interp) args))))))
+       (car interp) (append (cdr interp) args)))))
 
 (defun eshell/addpath (&rest args)
   "Add a set of paths to PATH."

Index: eshell/esh-proc.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/eshell/esh-proc.el,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- eshell/esh-proc.el  22 Jan 2009 06:33:07 -0000      1.26
+++ eshell/esh-proc.el  24 Nov 2009 10:25:58 -0000      1.27
@@ -261,7 +261,7 @@
 (defun eshell-gather-process-output (command args)
   "Gather the output from COMMAND + ARGS."
   (unless (and (file-executable-p command)
-              (file-regular-p command))
+              (file-regular-p (file-truename command)))
     (error "%s: not an executable file" command))
   (let* ((delete-exited-processes
          (if eshell-current-subjob-p
@@ -270,12 +270,13 @@
         (process-environment (eshell-environment-variables))
         proc decoding encoding changed)
     (cond
-     ((fboundp 'start-process)
+     ((fboundp 'start-file-process)
       (setq proc
            (let ((process-connection-type
                   (unless (eshell-needs-pipe-p command)
-                    process-connection-type)))
-             (apply 'start-process
+                    process-connection-type))
+                 (command (or (file-remote-p command 'localname) command)))
+             (apply 'start-file-process
                     (file-name-nondirectory command) nil
                     ;; `start-process' can't deal with relative filenames.
                     (append (list (expand-file-name command)) args))))

Index: eshell/esh-util.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/eshell/esh-util.el,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- eshell/esh-util.el  21 Mar 2009 14:00:26 -0000      1.38
+++ eshell/esh-util.el  24 Nov 2009 10:25:58 -0000      1.39
@@ -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,13 +697,8 @@
 (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)
+    (if (string-equal (file-remote-p file 'method) "ftp")
          (let ((base (file-name-nondirectory file))
                (dir (file-name-directory file)))
            (if (boundp 'ange-cache)
@@ -703,8 +713,8 @@
                  (let ((fentry (assoc base (cdr entry))))
                    (if fentry
                        (setq entry (cdr fentry))
-                     (setq entry nil)))))))
-      (or entry (funcall handler 'file-attributes file)))))
+                   (setq entry nil))))))
+      (file-attributes file))))
 
 (defalias 'eshell-copy-tree 'copy-tree)
 

Index: net/tramp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/tramp.el,v
retrieving revision 1.270
retrieving revision 1.271
diff -u -b -r1.270 -r1.271
--- net/tramp.el        23 Nov 2009 15:58:49 -0000      1.270
+++ net/tramp.el        24 Nov 2009 10:25:58 -0000      1.271
@@ -2383,6 +2383,35 @@
                           'tramp-rfn-eshadow-update-overlay))))
 
 
+;;; Integration of eshell.el:
+
+(eval-when-compile
+  (defvar eshell-path-env))
+
+;; eshell.el keeps the path in `eshell-path-env'.  We must change it
+;; when `default-directory' points to another host.
+(defun tramp-eshell-directory-change ()
+  "Set `eshell-path-env' to $PATH of the host related to `default-directory'."
+  (setq eshell-path-env
+       (if (file-remote-p default-directory)
+           (with-parsed-tramp-file-name default-directory nil
+             (mapconcat
+              'identity
+              (tramp-get-remote-path v)
+              ":"))
+         (getenv "PATH"))))
+
+(eval-after-load "esh-util"
+  '(progn
+     (tramp-eshell-directory-change)
+     (add-hook 'eshell-directory-change-hook
+              'tramp-eshell-directory-change)
+     (add-hook 'tramp-unload-hook
+              (lambda ()
+                (remove-hook 'eshell-directory-change-hook
+                             'tramp-eshell-directory-change)))))
+
+
 ;;; File Name Handler Functions:
 
 (defun tramp-handle-make-symbolic-link




reply via email to

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