emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/net/tramp.el,v


From: Michael Albinus
Subject: [Emacs-diffs] Changes to emacs/lisp/net/tramp.el,v
Date: Sun, 03 Feb 2008 12:05:08 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Michael Albinus <albinus>       08/02/03 12:05:06

Index: tramp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/tramp.el,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -b -r1.174 -r1.175
--- tramp.el    29 Jan 2008 21:14:04 -0000      1.174
+++ tramp.el    3 Feb 2008 12:05:05 -0000       1.175
@@ -3274,7 +3274,7 @@
                                (append copy-args (list source target))))))
                (tramp-message
                 v 6 "%s" (mapconcat 'identity (process-command p) " "))
-               (set-process-sentinel p 'tramp-flush-connection-property)
+               (set-process-sentinel p 'tramp-process-sentinel)
                (tramp-set-process-query-on-exit-flag p nil)
                (tramp-process-actions p v tramp-actions-copy-out-of-band))))
 
@@ -3315,8 +3315,7 @@
     (tramp-flush-directory-property v localname)
     (unless (zerop (tramp-send-command-and-check
                    v
-                   (format "rmdir -f %s"
-                           (tramp-shell-quote-argument localname))))
+                   (format "rmdir %s" (tramp-shell-quote-argument localname))))
       (tramp-error v 'file-error "Couldn't delete %s" directory))))
 
 (defun tramp-handle-delete-file (filename)
@@ -3649,9 +3648,10 @@
          ;; Send the command.
          (tramp-send-command
           v
-          (format "%s; exit"
+          (format "%s; echo %s; exit"
                   (mapconcat 'tramp-shell-quote-argument
-                             (cons program args) " "))
+                             (cons program args) " ")
+                  (tramp-shell-quote-argument tramp-end-of-output))
           nil t) ; nooutput
          ;; Return process.
          (tramp-get-connection-process v))
@@ -3804,13 +3804,13 @@
              (with-parsed-tramp-file-name default-directory nil
                (list output-buffer (tramp-make-tramp-temp-file v)))
            output-buffer))
-        (proc (get-buffer-process output-buffer)))
+        (p (get-buffer-process output-buffer)))
 
     ;; Check whether there is another process running.  Tramp does not
     ;; support 2 (asynchronous) processes in parallel.
-    (when proc
+    (when p
       (if (yes-or-no-p "A command is running.  Kill it? ")
-         (ignore-errors (kill-process proc))
+         (ignore-errors (kill-process p))
        (error "Shell command in progress")))
 
     (with-current-buffer output-buffer
@@ -3823,7 +3823,9 @@
            ;; Run the process.
            (apply 'start-file-process "*Async Shell*" buffer args)
          ;; Display output.
-         (pop-to-buffer output-buffer))
+         (pop-to-buffer output-buffer)
+         (setq mode-line-process '(":%s"))
+         (require 'shell) (shell-mode))
 
       (prog1
          ;; Run the process.
@@ -4190,7 +4192,7 @@
                        ;; conditions are satisfied, it tries to write
                        ;; to a local file in default-directory, but
                        ;; at this point, default-directory is remote.
-                       ;; (CALL-PROCESS-REGION can't write to remote
+                       ;; (`call-process-region' can't write to remote
                        ;; files, it seems.)  The file in question is
                        ;; a tmp file anyway.
                        (let ((default-directory
@@ -5305,7 +5307,9 @@
    vec (format "PATH=%s; export PATH"
               (mapconcat 'identity (tramp-get-remote-path vec) ":"))))
 
-;; -- communication with external shell --
+;; ------------------------------------------------------------
+;; -- Communication with external shell --
+;; ------------------------------------------------------------
 
 (defun tramp-find-file-exists-command (vec)
   "Find a command on the remote host for checking if a file exists.
@@ -5357,7 +5361,6 @@
        vec 'file-error "Couldn't find command to check if file exists"))
     result))
 
-
 ;; CCC test ksh or bash found for tilde expansion?
 (defun tramp-find-shell (vec)
   "Opens a shell on the remote host which groks tilde expansion."
@@ -5644,6 +5647,20 @@
                     'tramp-password-end-of-line)
                    tramp-default-password-end-of-line))))
 
+(defun tramp-process-sentinel (proc event)
+  "Process sentinel for Tramp processes."
+  (when (memq (process-status proc) '(stop exit signal))
+    (tramp-flush-connection-property proc)
+    ;; The "Connection closed" and "exit" messages disturb the output
+    ;; for asynchronous processes. That's why we have echoed the Tramp
+    ;; prompt at the end.  Trailing messages can be removed.
+    (with-current-buffer (process-buffer proc)
+      (goto-char (point-max))
+      (re-search-backward
+       (mapconcat 'identity (split-string tramp-end-of-output "\n") "\r?\n")
+       (line-beginning-position -8) t)
+      (delete-region (point) (point-max)))))
+
 (defun tramp-open-connection-setup-interactive-shell (proc vec)
   "Set up an interactive shell.
 Mainly sets the prompt and the echo correctly.  PROC is the shell
@@ -6176,7 +6193,7 @@
         vec 6 "%s" (mapconcat 'identity (process-command p) " "))
 
        ;; Check whether process is alive.
-       (set-process-sentinel p 'tramp-flush-connection-property)
+       (set-process-sentinel p 'tramp-process-sentinel)
        (tramp-set-process-query-on-exit-flag p nil)
        (tramp-message vec 3 "Waiting 60s for local shell to come up...")
        (tramp-barf-if-no-shell-prompt
@@ -7367,7 +7384,9 @@
 ;; ** Try to avoid usage of `last-input-event' in `tramp-completion-mode-p'.
 ;; ** Unify `tramp-parse-{rhosts,shosts,sconfig,hosts,passwd,netrc}'.
 ;;    Code is nearly identical.
-;; * Allow out-of-band methods as _last_ multi-hop.
+;; * Allow out-of-band methods as _last_ multi-hop.  Open a connection
+;;   until the last but one hop via `start-file-process'.  Apply it
+;;   also for ftp and smb.
 ;; * WIBNI if we had a command "trampclient"?  If I was editing in
 ;;   some shell with root priviledges, it would be nice if I could
 ;;   just call




reply via email to

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