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: Thu, 04 Oct 2007 20:09:34 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Michael Albinus <albinus>       07/10/04 20:09:33

Index: net/tramp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/tramp.el,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -b -r1.142 -r1.143
--- net/tramp.el        3 Oct 2007 10:54:03 -0000       1.142
+++ net/tramp.el        4 Oct 2007 20:09:32 -0000       1.143
@@ -1974,13 +1974,6 @@
 (put 'tramp-let-maybe 'lisp-indent-function 2)
 (put 'tramp-let-maybe 'edebug-form-spec t)
 
-(defsubst tramp-make-temp-file (filename)
-  (concat
-   (make-temp-name
-    (expand-file-name
-     tramp-temp-name-prefix (tramp-compat-temporary-file-directory)))
-   (file-name-extension filename t)))
-
 (defsubst tramp-make-tramp-temp-file (vec)
   (format
    "/tmp/%s%s"
@@ -3071,8 +3064,7 @@
              (if t1 (tramp-handle-file-remote-p filename 'localname) filename))
             (localname2
              (if t2 (tramp-handle-file-remote-p newname 'localname) newname))
-            (prefix (file-remote-p (if t1 filename newname)))
-            (tmpfile (tramp-make-temp-file localname1)))
+            (prefix (file-remote-p (if t1 filename newname))))
 
        (cond
         ;; Both files are on a remote host, with same user.
@@ -3124,6 +3116,7 @@
           ;; We need a temporary file in between.
           (t
            ;; Create the temporary file.
+           (let ((tmpfile (tramp-compat-make-temp-file localname1)))
            (cond
             (t1
              (tramp-send-command
@@ -3157,7 +3150,7 @@
                  (tramp-shell-quote-argument tmpfile)
                  (tramp-shell-quote-argument localname2))))
             (t1
-             (rename-file tmpfile localname2 ok-if-already-exists))))))))
+               (rename-file tmpfile localname2 ok-if-already-exists)))))))))
 
       ;; Set the time and mode. Mask possible errors.
       ;; Won't be applied for 'rename.
@@ -3736,7 +3729,7 @@
 (defun tramp-handle-call-process-region
   (start end program &optional delete buffer display &rest args)
   "Like `call-process-region' for Tramp files."
-  (let ((tmpfile (tramp-make-temp-file "")))
+  (let ((tmpfile (tramp-compat-make-temp-file "")))
     (write-region start end tmpfile)
     (when delete (delete-region start end))
     (unwind-protect
@@ -3798,7 +3791,7 @@
   (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-make-temp-file filename)))
+         (tmpfile (tramp-compat-make-temp-file filename)))
       (unless (file-exists-p filename)
        (tramp-error
         v 'file-error
@@ -3837,7 +3830,7 @@
                      (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-make-temp-file filename)))
+           (let ((tmpfile2 (tramp-compat-make-temp-file filename)))
              (let ((coding-system-for-write 'binary))
                (write-region (point-min) (point-max) tmpfile2))
              (tramp-message
@@ -4055,6 +4048,14 @@
       (unless (y-or-n-p (format "File %s exists; overwrite anyway? " filename))
        (tramp-error v 'file-error "File not overwritten")))
 
+    (if (and (tramp-local-host-p v)
+            (file-writable-p (file-name-directory localname)))
+       ;; Short track: if we are on the local host, we can run directly.
+       (if confirm
+           (write-region
+            start end localname append 'no-message lockname confirm)
+         (write-region start end localname append 'no-message lockname))
+
     (let ((rem-dec (tramp-get-remote-coding v "remote-decoding"))
          (loc-enc (tramp-get-local-coding v "local-encoding"))
          (modes (save-excursion (file-modes filename)))
@@ -4068,15 +4069,7 @@
          ;; Write region into a tmp file.  This isn't really needed if we
          ;; use an encoding function, but currently we use it always
          ;; because this makes the logic simpler.
-         (tmpfile (tramp-make-temp-file filename)))
-
-      (if (and (tramp-local-host-p v)
-              (file-writable-p (file-name-directory localname)))
-         ;; Short track: if we are on the local host, we can run directly.
-         (if confirm
-             (write-region
-              start end localname append 'no-message lockname confirm)
-           (write-region start end localname append 'no-message lockname))
+           (tmpfile (tramp-compat-make-temp-file filename)))
 
        ;; We say `no-message' here because we don't want the visited file
        ;; modtime data to be clobbered from the temp file.  We call
@@ -4201,8 +4194,13 @@
           v 'file-error
           (concat "Method `%s' should specify both encoding and "
                   "decoding command or an rcp program")
-          method))))
+          method)))
 
+       ;; Make `last-coding-system-used' have the right value.
+       (when coding-system-used
+         (set 'last-coding-system-used coding-system-used)))
+
+      ;; Set file modification time.
       (when (or (eq visit t) (stringp visit))
        (set-visited-file-modtime
         ;; We must pass modtime explicitely, because filename can be different
@@ -4210,9 +4208,6 @@
         (nth 5 (file-attributes filename))))
       ;; Set the ownership.
       (tramp-set-file-uid-gid filename)
-      ;; Make `last-coding-system-used' have the right value.
-      (when coding-system-used
-       (set 'last-coding-system-used coding-system-used))
       (when (or (eq visit t) (null visit) (stringp visit))
        (tramp-message v 0 "Wrote %s" filename))
       (run-hooks 'tramp-handle-write-region-hook))))
@@ -7558,12 +7553,6 @@
 ;; * When editing a remote CVS controlled file as a different user, VC
 ;;   gets confused about the file locking status.  Try to find out why
 ;;   the workaround doesn't work.
-;; * Change `copy-file' to grok the case where the filename handler
-;;   for the source and the target file are different.  Right now,
-;;   it looks at the source file and then calls that handler, if
-;;   there is one.  But since ange-ftp, for instance, does not know
-;;   about Tramp, it does not do the right thing if the target file
-;;   name is a Tramp name.
 ;; * Username and hostname completion.
 ;; ** Try to avoid usage of `last-input-event' in `tramp-completion-mode-p'.
 ;; ** Unify `tramp-parse-{rhosts,shosts,sconfig,hosts,passwd,netrc}'.




reply via email to

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