]> git.eshelyaron.com Git - emacs.git/commitdiff
* net/tramp.el: Redo sync with Tramp 2.0.45. Last commit did not
authorMichael Albinus <michael.albinus@gmx.de>
Sun, 17 Oct 2004 14:05:51 +0000 (14:05 +0000)
committerMichael Albinus <michael.albinus@gmx.de>
Sun, 17 Oct 2004 14:05:51 +0000 (14:05 +0000)
work correctly.

lisp/ChangeLog
lisp/net/tramp.el

index a8a0b1776fc2663fe1784b9ccf261001a1b42acd..7eec61491390da9339f35b056227fb64389b4a30 100644 (file)
@@ -1,3 +1,8 @@
+2004-10-17  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el: Redo sync with Tramp 2.0.45.  Last commit did not
+       work correctly.
+
 2004-10-17  Daniel Pfeiffer  <occitan@esperanto.org>
 
        * buff-menu.el (Buffer-menu-revert-function): Emulate save-excursion.
index a30280dbd4f4ef5016402d87f113a5dbb5174d23..582ae8ee207294256c5f693470072c3cec1ec226 100644 (file)
@@ -2337,45 +2337,46 @@ If it doesn't exist, generate a new one."
 ;; This function makes the same assumption as
 ;; `tramp-handle-set-visited-file-modtime'.
 (defun tramp-handle-verify-visited-file-modtime (buf)
-  "Like `verify-visited-file-modtime' for tramp files.
-At the time `verify-visited-file-modtime' calls this function, we
-already know that the buffer is visiting a file and that
-`visited-file-modtime' does not return 0.  Do not call this
-function directly, unless those two cases are already taken care
-of."
+  "Like `verify-visited-file-modtime' for tramp files."
   (with-current-buffer buf
-    (let ((f (buffer-file-name)))
-      (with-parsed-tramp-file-name f nil
-       (let* ((attr (file-attributes f))
-              (modtime (nth 5 attr)))
-         (cond ((and attr (not (equal modtime '(0 0))))
-                ;; Why does `file-attributes' return a list (HIGH
-                ;; LOW), but `visited-file-modtime' returns a cons
-                ;; (HIGH . LOW)?
-                (let ((mt (visited-file-modtime)))
-                  (< (abs (tramp-time-diff
-                           modtime
-                           ;; For compatibility, deal with both the old
-                           ;; (HIGH . LOW) and the new (HIGH LOW)
-                           ;; return values of `visited-file-modtime'.
-                           (if (atom (cdr mt))
-                               (list (car mt) (cdr mt))
-                             mt)))
-                     2)))
-               (attr
-                (save-excursion
-                  (tramp-send-command
-                   multi-method method user host
-                   (format "%s -ild %s"
-                           (tramp-get-ls-command multi-method method
-                                                 user host)
-                           (tramp-shell-quote-argument localname)))
-                  (tramp-wait-for-output)
-                  (setq attr (buffer-substring
-                              (point) (progn (end-of-line) (point)))))
-                (equal tramp-buffer-file-attributes attr))
-               ;; If file does not exist, say it is not modified.
-               (t nil)))))))
+    ;; There is no file visiting the buffer, or the buffer has no
+    ;; recorded last modification time.
+    (if (or (not (buffer-file-name))
+           (eq (visited-file-modtime) 0))
+      t
+      (let ((f (buffer-file-name)))
+       (with-parsed-tramp-file-name f nil
+         (let* ((attr (file-attributes f))
+                (modtime (nth 5 attr))
+                (mt (visited-file-modtime)))
+           
+           (cond
+            ;; file exists, and has a known modtime.
+            ((and attr (not (equal modtime '(0 0))))
+             (< (abs (tramp-time-diff
+                      modtime
+                      ;; For compatibility, deal with both the old
+                      ;; (HIGH . LOW) and the new (HIGH LOW)
+                      ;; return values of `visited-file-modtime'.
+                      (if (atom (cdr mt))
+                          (list (car mt) (cdr mt))
+                        mt)))
+                2))
+            ;; modtime has the don't know value.
+            (attr
+             (save-excursion
+               (tramp-send-command
+                multi-method method user host
+                (format "%s -ild %s"
+                        (tramp-get-ls-command multi-method method user host)
+                        (tramp-shell-quote-argument localname)))
+               (tramp-wait-for-output)
+               (setq attr (buffer-substring
+                           (point) (progn (end-of-line) (point)))))
+             (equal tramp-buffer-file-attributes attr))
+            ;; If file does not exist, say it is not modified
+            ;; if and only if that agrees with the buffer's record.
+            (t (equal mt '(-1 65535))))))))))
 
 (defadvice clear-visited-file-modtime (after tramp activate)
   "Set `tramp-buffer-file-attributes' back to nil.