tramp-devel
[Top][All Lists]
Advanced

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

[PATCH 1/1] Yet another go at tramp-handle-process-file, with proper sco


From: Julian Scheid
Subject: [PATCH 1/1] Yet another go at tramp-handle-process-file, with proper scope for tramp-process-inhibit-flush
Date: Wed, 19 Aug 2009 11:26:22 +1200

Whoops, tramp-process-inhibit-flush must be set for
tramp-run-real-handler 'vc-registered.

---
 lisp/ChangeLog |    8 ++++++++
 lisp/tramp.el  |   31 +++++++++++++++++++------------
 2 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4a9d8cb..0cafcf2 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,13 @@
 2009-08-18  Julian Scheid  <address@hidden>
 
+       * tramp.el (tramp-process-inhibit-flush): New defvar.
+       (tramp-vc-registered-read-file-names): Set
+       tramp-process-inhibit-flush.
+       (tramp-handle-process-file): Merge three remote ops into one.  Do
+       not flush all caches when tramp-process-inhibit-flush is set.
+
+2009-08-18  Julian Scheid  <address@hidden>
+
        * tramp.el (tramp-check-cached-permissions) New defun.
        (tramp-handle-file-readable-p): Use it.
        (tramp-handle-file-writable-p): Likewise.
diff --git a/lisp/tramp.el b/lisp/tramp.el
index 854ac8c..0a0ebe2 100644
--- a/lisp/tramp.el
+++ b/lisp/tramp.el
@@ -4190,6 +4190,11 @@ beginning of local filename are not substituted."
       (tramp-set-connection-property v "process-name" nil)
       (tramp-set-connection-property v "process-buffer" nil))))
 
+(defvar tramp-process-inhibit-flush nil
+  "When non-nil, do not flush all file and directory caches for
+the current connection when an external process is invoked on the
+remote host.")
+
 (defun tramp-handle-process-file
   (program &optional infile destination display &rest args)
   "Like `process-file' for Tramp files."
@@ -4254,20 +4259,20 @@ beginning of local filename are not substituted."
        (setq outbuf (current-buffer))))
       (when stderr (setq command (format "%s 2>%s" command stderr)))
 
-      ;; Goto working directory.
-      (tramp-send-command
-       v (format "cd %s" (tramp-shell-quote-argument localname)))
       ;; Send the command.  It might not return in time, so we protect it.
       (condition-case nil
          (unwind-protect
-             (tramp-send-command v command)
+              (setq ret
+                    (tramp-send-command-and-check
+                     v (format "\\cd %s; %s"
+                               (tramp-shell-quote-argument localname)
+                               command)))
            ;; We should show the output anyway.
            (when outbuf
-             (let ((output-string
-                    (with-current-buffer (tramp-get-connection-buffer v)
-                      (buffer-substring (point-min) (point-max)))))
                (with-current-buffer outbuf
-                 (insert output-string)))
+                (insert
+                 (with-current-buffer (tramp-get-buffer v)
+                   (buffer-string))))
              (when display (display-buffer outbuf))))
        ;; When the user did interrupt, we should do it also.  We use
        ;; return code -1 as marker.
@@ -4279,14 +4284,15 @@ beginning of local filename are not substituted."
         (kill-buffer (tramp-get-connection-buffer v))
         (setq ret 1)))
 
-      ;; Check return code.
-      (unless ret (setq ret (tramp-send-command-and-check v nil)))
       ;; Provide error file.
       (when tmpstderr (rename-file tmpstderr (cadr destination) t))
       ;; Cleanup.  We remove all file cache values for the connection,
       ;; because the remote process could have changed them.
       (when tmpinput (delete-file tmpinput))
-      (tramp-flush-directory-property v "")
+
+      (unless tramp-process-inhibit-flush
+        (tramp-flush-directory-property v ""))
+
       ;; Return exit status.
       (if (equal ret -1)
          (keyboard-quit)
@@ -4991,7 +4997,8 @@ Returns a file name in `tramp-auto-save-directory' for 
autosaving this file."
        (tramp-set-file-property v (car elt) (cadr elt)   (cadr (cdr elt)))))
 
     ;; Second run. Now all requests shall be answered from the file cache.
-    (tramp-run-real-handler 'vc-registered (list file))))
+    (let ((tramp-process-inhibit-flush t))
+      (tramp-run-real-handler 'vc-registered (list file)))))
 
 ;;;###autoload
 (progn (defun tramp-run-real-handler (operation args)
-- 
1.6.4





reply via email to

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