emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp/net tramp.el


From: Michael Albinus
Subject: [Emacs-diffs] emacs/lisp/net tramp.el
Date: Tue, 06 Jan 2009 07:51:10 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Michael Albinus <albinus>       09/01/06 07:51:10

Modified files:
        lisp/net       : tramp.el 

Log message:
        * net/tramp.el (tramp-do-copy-or-rename-file-directly)
        (tramp-handle-file-local-copy, tramp-handle-write-region)
        Delete temporary file in case of quit.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/net/tramp.el?cvsroot=emacs&r1=1.221&r2=1.222

Patches:
Index: tramp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/tramp.el,v
retrieving revision 1.221
retrieving revision 1.222
diff -u -b -r1.221 -r1.222
--- tramp.el    5 Jan 2009 19:37:01 -0000       1.221
+++ tramp.el    6 Jan 2009 07:51:09 -0000       1.222
@@ -3302,7 +3302,8 @@
                     (list tmpfile localname2 ok-if-already-exists)))))
 
              ;; Error handling.
-             (error (delete-file tmpfile)
+             ((error quit)
+              (delete-file tmpfile)
                     (signal (car err) (cdr err)))))))))
 
       ;; Set the time and mode. Mask possible errors.
@@ -4011,19 +4012,22 @@
   "Like `file-local-copy' for Tramp files."
 
   (with-parsed-tramp-file-name filename nil
-    (let ((rem-enc (tramp-get-remote-coding v "remote-encoding"))
-         (loc-dec (tramp-get-local-coding v "local-decoding"))
-         (tmpfile (tramp-compat-make-temp-file filename)))
       (unless (file-exists-p filename)
        (tramp-error
         v 'file-error
         "Cannot make local copy of non-existing file `%s'" filename))
 
+    (let ((rem-enc (tramp-get-remote-coding v "remote-encoding"))
+         (loc-dec (tramp-get-local-coding v "local-decoding"))
+         (tmpfile (tramp-compat-make-temp-file filename)))
+
+      (condition-case err
       (cond
        ;; `copy-file' handles direct copy and out-of-band methods.
        ((or (tramp-local-host-p v)
            (and (tramp-method-out-of-band-p v)
-                (> (nth 7 (file-attributes filename)) tramp-copy-size-limit)))
+                    (> (nth 7 (file-attributes filename))
+                       tramp-copy-size-limit)))
        (copy-file filename tmpfile t t))
 
        ;; Use inline encoding for file transfer.
@@ -4031,16 +4035,16 @@
        (save-excursion
          (tramp-message v 5 "Encoding remote file %s..." filename)
          (tramp-barf-unless-okay
-          v (format "%s < %s" rem-enc (tramp-shell-quote-argument localname))
+              v
+              (format "%s < %s" rem-enc (tramp-shell-quote-argument localname))
           "Encoding remote file failed")
          (tramp-message v 5 "Encoding remote file %s...done" filename)
 
-         (tramp-message v 5 "Decoding remote file %s..." filename)
          (if (and (symbolp loc-dec) (fboundp loc-dec))
-             ;; If local decoding is a function, we call it.  We must
-             ;; disable multibyte, because `uudecode-decode-region'
-             ;; doesn't handle it correctly.
-             (unwind-protect
+                 ;; If local decoding is a function, we call it.  We
+                 ;; must disable multibyte, because
+                 ;; `uudecode-decode-region' doesn't handle it
+                 ;; correctly.
                  (with-temp-buffer
                    (set-buffer-multibyte nil)
                    (insert-buffer-substring (tramp-get-buffer v))
@@ -4049,7 +4053,8 @@
                     filename loc-dec)
                    (funcall loc-dec (point-min) (point-max))
                    (let ((coding-system-for-write 'binary))
-                     (write-region (point-min) (point-max) tmpfile))))
+                     (write-region (point-min) (point-max) tmpfile)))
+
            ;; If tramp-decoding-function is not defined for this
            ;; method, we invoke tramp-decoding-command instead.
            (let ((tmpfile2 (tramp-compat-make-temp-file filename)))
@@ -4061,6 +4066,7 @@
              (unwind-protect
                  (tramp-call-local-coding-command loc-dec tmpfile2 tmpfile)
                (delete-file tmpfile2))))
+
          (tramp-message v 5 "Decoding remote file %s...done" filename)
          ;; Set proper permissions.
          (set-file-modes tmpfile (file-modes filename))
@@ -4071,6 +4077,11 @@
        (t (tramp-error
           v 'file-error "Wrong method specification for `%s'" method)))
 
+       ;; Error handling.
+       ((error quit)
+        (delete-file tmpfile)
+        (signal (car err) (cdr err))))
+
       (run-hooks 'tramp-handle-file-local-copy-hook)
       tmpfile)))
 
@@ -4346,7 +4357,8 @@
                (tramp-run-real-handler
                 'write-region
                 (list start end tmpfile append 'no-message lockname confirm))
-             (error (delete-file tmpfile)
+             ((error quit)
+              (delete-file tmpfile)
                     (signal (car err) (cdr err))))
 
            ;; Now, `last-coding-system-used' has the right value.  Remember it.
@@ -4375,7 +4387,8 @@
                        tramp-copy-size-limit)))
            (condition-case err
                (rename-file tmpfile filename t)
-             (error (delete-file tmpfile)
+             ((error quit)
+              (delete-file tmpfile)
                     (signal (car err) (cdr err)))))
 
           ;; Use inline file transfer.




reply via email to

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