/[emacs]/emacs/lisp/net/tramp.el
ViewVC logotype

Diff of /emacs/lisp/net/tramp.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.39.2.7 by miles, Thu Oct 14 08:49:58 2004 UTC revision 1.39.2.8 by miles, Fri Oct 22 10:13:30 2004 UTC
# Line 2337  If it doesn't exist, generate a new one. Line 2337  If it doesn't exist, generate a new one.
2337  ;; This function makes the same assumption as  ;; This function makes the same assumption as
2338  ;; `tramp-handle-set-visited-file-modtime'.  ;; `tramp-handle-set-visited-file-modtime'.
2339  (defun tramp-handle-verify-visited-file-modtime (buf)  (defun tramp-handle-verify-visited-file-modtime (buf)
2340    "Like `verify-visited-file-modtime' for tramp files.    "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."  
2341    (with-current-buffer buf    (with-current-buffer buf
2342      (let ((f (buffer-file-name)))      ;; There is no file visiting the buffer, or the buffer has no
2343        (with-parsed-tramp-file-name f nil      ;; recorded last modification time.
2344          (let* ((attr (file-attributes f))      (if (or (not (buffer-file-name))
2345                 (modtime (nth 5 attr)))              (eq (visited-file-modtime) 0))
2346            (cond ((and attr (not (equal modtime '(0 0))))        t
2347                   ;; Why does `file-attributes' return a list (HIGH        (let ((f (buffer-file-name)))
2348                   ;; LOW), but `visited-file-modtime' returns a cons          (with-parsed-tramp-file-name f nil
2349                   ;; (HIGH . LOW)?            (let* ((attr (file-attributes f))
2350                   (let ((mt (visited-file-modtime)))                   (modtime (nth 5 attr))
2351                     (< (abs (tramp-time-diff                   (mt (visited-file-modtime)))
2352                              modtime              
2353                              ;; For compatibility, deal with both the old              (cond
2354                              ;; (HIGH . LOW) and the new (HIGH LOW)               ;; file exists, and has a known modtime.
2355                              ;; return values of `visited-file-modtime'.               ((and attr (not (equal modtime '(0 0))))
2356                              (if (atom (cdr mt))                (< (abs (tramp-time-diff
2357                                  (list (car mt) (cdr mt))                         modtime
2358                                mt)))                         ;; For compatibility, deal with both the old
2359                        2)))                         ;; (HIGH . LOW) and the new (HIGH LOW)
2360                  (attr                         ;; return values of `visited-file-modtime'.
2361                   (save-excursion                         (if (atom (cdr mt))
2362                     (tramp-send-command                             (list (car mt) (cdr mt))
2363                      multi-method method user host                           mt)))
2364                      (format "%s -ild %s"                   2))
2365                              (tramp-get-ls-command multi-method method               ;; modtime has the don't know value.
2366                                                    user host)               (attr
2367                              (tramp-shell-quote-argument localname)))                (save-excursion
2368                     (tramp-wait-for-output)                  (tramp-send-command
2369                     (setq attr (buffer-substring                   multi-method method user host
2370                                 (point) (progn (end-of-line) (point)))))                   (format "%s -ild %s"
2371                   (equal tramp-buffer-file-attributes attr))                           (tramp-get-ls-command multi-method method user host)
2372                  ;; If file does not exist, say it is not modified.                           (tramp-shell-quote-argument localname)))
2373                  (t nil)))))))                  (tramp-wait-for-output)
2374                    (setq attr (buffer-substring
2375                                (point) (progn (end-of-line) (point)))))
2376                  (equal tramp-buffer-file-attributes attr))
2377                 ;; If file does not exist, say it is not modified
2378                 ;; if and only if that agrees with the buffer's record.
2379                 (t (equal mt '(-1 65535))))))))))
2380    
2381  (defadvice clear-visited-file-modtime (after tramp activate)  (defadvice clear-visited-file-modtime (after tramp activate)
2382    "Set `tramp-buffer-file-attributes' back to nil.    "Set `tramp-buffer-file-attributes' back to nil.

Legend:
Removed from v.1.39.2.7  
changed lines
  Added in v.1.39.2.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26