From: Kai Gro?j. <ka...@us...> - 2001-12-25 21:38:56
|
Update of /cvsroot/tramp/tramp/lisp In directory usw-pr-cvs1:/tmp/cvs-serv31296/tramp/lisp Modified Files: ChangeLog tramp.el Log Message: (tramp-buffer-file-attributes): New variable. (tramp-handle-set-visited-file-modtime): Use it in case the remote end does not give us the right modtime. (tramp-handle-verify-visited-file-modtime): Implementation. Index: ChangeLog =================================================================== RCS file: /cvsroot/tramp/tramp/lisp/ChangeLog,v retrieving revision 2.46 retrieving revision 2.47 diff -C2 -d -r2.46 -r2.47 *** ChangeLog 2001/12/07 12:00:39 2.46 --- ChangeLog 2001/12/25 21:38:53 2.47 *************** *** 1,2 **** --- 1,9 ---- + 2001-12-25 Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> + + * tramp.el (tramp-buffer-file-attributes): New variable. + (tramp-handle-set-visited-file-modtime): Use it in case the + remote end does not give us the right modtime. + (tramp-handle-verify-visited-file-modtime): Implementation. + 2001-12-07 Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> Index: tramp.el =================================================================== RCS file: /cvsroot/tramp/tramp/lisp/tramp.el,v retrieving revision 2.49 retrieving revision 2.50 diff -C2 -d -r2.49 -r2.50 *** tramp.el 2001/12/25 20:54:05 2.49 --- tramp.el 2001/12/25 21:38:53 2.50 *************** *** 946,949 **** --- 946,956 ---- ;;; Internal Variables: + (defvar tramp-buffer-file-attributes nil + "Holds the `ls -li' output for the current buffer. + This variable is local to each buffer. It is not used if the remote + machine groks Perl. If it is used, it's used as an emulation for + the visited file modtime.") + (make-variable-buffer-local 'tramp-buffer-file-attributes) + (defvar tramp-end-of-output "/////" "String used to recognize end of output.") *************** *** 1501,1504 **** --- 1508,1515 ---- result)) + ;; This function assumes that we can get the precise modtime iff Perl + ;; is present. When we change Tramp to use the fstat(1) program, then + ;; we need to change this assumtion. Maybe we should just check for a + ;; sentinel value in the return value of `file-attributes'? (defun tramp-handle-set-visited-file-modtime (&optional time-list) "Like `set-visited-file-modtime' for tramp files." *************** *** 1511,1525 **** (user (tramp-file-name-user v)) (host (tramp-file-name-host v)) ! (path (tramp-file-name-path v))) (if (tramp-get-remote-perl multi-method method user host) ! (let ((attr (file-attributes f))) ! (set-visited-file-modtime (nth 5 attr))) ! ;;CCC continue here ! nil))) (defun tramp-handle-verify-visited-file-modtime (buf) "Like `verify-visited-file-modtime' for tramp files." ! nil) ! (defun tramp-handle-set-file-modes (filename mode) --- 1522,1553 ---- (user (tramp-file-name-user v)) (host (tramp-file-name-host v)) ! (path (tramp-file-name-path v)) ! (attr (file-attributes f)) ! (modtime (nth 5 attr))) (if (tramp-get-remote-perl multi-method method user host) ! (set-visited-file-modtime modtime) ! (setq tramp-buffer-file-attributes attr)) ! nil)) + ;; 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." ! (with-current-buffer buf ! (let* ((f (buffer-file-name)) ! (v (tramp-dissect-file-name f)) ! (multi-method (tramp-file-name-multi-method v)) ! (method (tramp-file-name-method v)) ! (user (tramp-file-name-user v)) ! (host (tramp-file-name-host v)) ! (path (tramp-file-name-path v)) ! (attr (file-attributes f)) ! (modtime (nth 5 attr))) ! (if (tramp-get-remote-perl multi-method method user host) ! ;; Why does `file-attributes' return a list (HIGH LOW), but ! ;; `visited-file-modtime' returns a cons (HIGH . LOW)? ! (and (equal (car (visited-file-modtime)) (nth 0 modtime)) ! (equal (cdr (visited-file-modtime)) (nth 1 modtime))) ! (equal tramp-buffer-file-attributes attr))))) (defun tramp-handle-set-file-modes (filename mode) |