From: Kai Gro?j. <ka...@us...> - 2001-12-27 17:28:12
|
Update of /cvsroot/tramp/tramp/lisp In directory usw-pr-cvs1:/tmp/cvs-serv13627/tramp/lisp Modified Files: ChangeLog tramp.el Log Message: (tramp-handle-set-visited-file-modtime): More error checking. If `file-attributes' returns modtime (0 0), then assume modtime isn't known and revert to using `ls -ild'. Previously, we checked if Perl was available. (tramp-handle-verify-visited-file-modtime): Check for modtime being (0 0), rather than Perl being available. (tramp-handle-write-region): Some sanity checking: make sure that current buffer isn't changed while the function runs. (Maybe this is not necessary now?) Only set-visited-file-modtime if VISIT is t (used to check for non-nil). (tramp-make-auto-save-file-name): Construct a local filename, then run `make-auto-save-file-name' on it. This makes sure that no filename handlers will be run on that file. (Specifically, this avoids jka-compr -- we want auto-save files to be saved quickly. This fixes the change from 2001-12-07 which aimed at doing the same thing, but failed.) Index: ChangeLog =================================================================== RCS file: /cvsroot/tramp/tramp/lisp/ChangeLog,v retrieving revision 2.49 retrieving revision 2.50 diff -C2 -d -r2.49 -r2.50 *** ChangeLog 2001/12/27 16:21:26 2.49 --- ChangeLog 2001/12/27 17:28:08 2.50 *************** *** 4,7 **** --- 4,23 ---- Instead, make sure that jka-compr comes first in file-name-handler-alist. + (tramp-handle-set-visited-file-modtime): More error checking. If + `file-attributes' returns modtime (0 0), then assume modtime isn't + known and revert to using `ls -ild'. Previously, we checked if + Perl was available. + (tramp-handle-verify-visited-file-modtime): Check for modtime + being (0 0), rather than Perl being available. + (tramp-handle-write-region): Some sanity checking: make sure that + current buffer isn't changed while the function runs. (Maybe this + is not necessary now?) Only set-visited-file-modtime if VISIT is + t (used to check for non-nil). + (tramp-make-auto-save-file-name): Construct a local filename, then + run `make-auto-save-file-name' on it. This makes sure that no + filename handlers will be run on that file. (Specifically, this + avoids jka-compr -- we want auto-save files to be saved quickly. + This fixes the change from 2001-12-07 which aimed at doing the + same thing, but failed.) 2001-12-26 Kai Grossjohann <ka...@ls...> Index: tramp.el =================================================================== RCS file: /cvsroot/tramp/tramp/lisp/tramp.el,v retrieving revision 2.52 retrieving revision 2.53 diff -C2 -d -r2.52 -r2.53 *** tramp.el 2001/12/27 16:21:26 2.52 --- tramp.el 2001/12/27 17:28:08 2.53 *************** *** 1501,1510 **** 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." (let* ((f (buffer-file-name)) (v (tramp-dissect-file-name f)) --- 1501,1509 ---- result)) (defun tramp-handle-set-visited-file-modtime (&optional time-list) "Like `set-visited-file-modtime' for tramp files." + (unless (buffer-file-name) + (error "Can't set-visited-file-modtime: buffer `%s' not visiting a file" + (buffer-name))) (let* ((f (buffer-file-name)) (v (tramp-dissect-file-name f)) *************** *** 1516,1520 **** (attr (file-attributes f)) (modtime (nth 5 attr))) ! (if (tramp-get-remote-perl multi-method method user host) (tramp-run-real-handler 'set-visited-file-modtime (list modtime)) (save-excursion --- 1515,1521 ---- (attr (file-attributes f)) (modtime (nth 5 attr))) ! ;; We use '(0 0) as a don't-know value. See also ! ;; `tramp-handle-file-attributes-with-ls'. ! (if (not (equal modtime '(0 0))) (tramp-run-real-handler 'set-visited-file-modtime (list modtime)) (save-excursion *************** *** 1544,1548 **** (attr (file-attributes f)) (modtime (nth 5 attr))) ! (if nil ;(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)? --- 1545,1549 ---- (attr (file-attributes f)) (modtime (nth 5 attr))) ! (if (not (equal modtime '(0 0))) ;; Why does `file-attributes' return a list (HIGH LOW), but ;; `visited-file-modtime' returns a cons (HIGH . LOW)? *************** *** 2467,2471 **** filename)) (error "File not overwritten"))) ! (let* ((v (tramp-dissect-file-name filename)) (multi-method (tramp-file-name-multi-method v)) (method (tramp-file-name-method v)) --- 2468,2473 ---- filename)) (error "File not overwritten"))) ! (let* ((curbuf (current-buffer)) ! (v (tramp-dissect-file-name filename)) (multi-method (tramp-file-name-multi-method v)) (method (tramp-file-name-method v)) *************** *** 2625,2629 **** (when (boundp 'last-coding-system-used) (setq last-coding-system-used coding-system-used)) ! (when visit (set-visited-file-modtime)) (when (or (eq visit t) --- 2627,2634 ---- (when (boundp 'last-coding-system-used) (setq last-coding-system-used coding-system-used)) ! (unless (equal curbuf (current-buffer)) ! (error "Buffer has changed from `%s' to `%s'" ! curbuf (current-buffer))) ! (when (eq visit t) (set-visited-file-modtime)) (when (or (eq visit t) *************** *** 4469,4482 **** ;; file name we make sure that jka-compr isn't used for the ;; auto-save file. ! (expand-file-name ! (concat (tramp-subst-strs-in-string '(("_" . "|") ! ("/" . "_a") ! (":" . "_b") ! ("|" . "__") ! ("[" . "_l") ! ("]" . "_r")) ! fn) ! "~") ! tramp-auto-save-directory)) (defadvice make-auto-save-file-name --- 4474,4487 ---- ;; file name we make sure that jka-compr isn't used for the ;; auto-save file. ! (let ((buffer-file-name (expand-file-name ! (tramp-subst-strs-in-string '(("_" . "|") ! ("/" . "_a") ! (":" . "_b") ! ("|" . "__") ! ("[" . "_l") ! ("]" . "_r")) ! fn) ! tramp-auto-save-directory))) ! (make-auto-save-file-name))) (defadvice make-auto-save-file-name |