all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Luc Teirlinck <teirllm@dms.auburn.edu>
Cc: emacs-devel@gnu.org
Subject: Re: (tramp-handleverify-visited-file-modtime
Date: Sat, 24 Jul 2004 21:11:01 -0500 (CDT)	[thread overview]
Message-ID: <200407250211.i6P2B1j28553@raven.dms.auburn.edu> (raw)
In-Reply-To: <87acxpjla1.fsf@gmx.de> (message from Michael Albinus on Sat, 24 Jul 2004 20:46:30 +0200)

Michael Albinus wrote:

   Luc Teirlinck <teirllm@dms.auburn.edu> writes:

   > Because `tramp-handle-verify-visited-file-modtime' is supposed to
   > emulate `verify-visited-file-modtime' I believe it should return t,
   > like `visited-visited-file-modtime' does.
   >
   > So what about the following patch?

   I've committed a looks-like-this patch to Tramp CVS.

   Best regards, Michael.

Actually, I recommend the following patch to the present Tramp CVS
version (not the Emacs CVS version) of tramp.el.  The reason is that
we want to return t for a file that does not exist according to
`file-attributes' _and_ for which (visited-file-modtime) returns -1,
but nil if `file-attributes' returns nil and `visited-file-modtime'
returns a "real" modtime (neither 0 nor -1), meaning the file _did_
exist the last time we checked, but has been deleted in the meantime.

To be completely consistent with `verify-visited-file-modtime' we
should also return nil if the file system could not handle the file
name because it was too long (never happens on the GNU system) or
because there were too many symbolic links to follow.  I do not know
whether this case is important enough to worry about.  (The patch
below does not.)  How were we even able to visit the file in the first
place in such a situation?


===File ~/tramp-CVS-diff====================================
*** tramp.el	24 Jul 2004 14:12:22 -0500	2.381
--- tramp.el	24 Jul 2004 19:34:27 -0500	
***************
*** 2342,2360 ****
        (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))))
! 		   (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)))
  		  ;; modtime has the don't know value.
  		  (attr
  		   (save-excursion
--- 2342,2360 ----
        (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 ((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
***************
*** 2368,2375 ****
  		     (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 t))))))))
  
  (defadvice clear-visited-file-modtime (after tramp activate)
    "Set `tramp-buffer-file-attributes' back to nil.
--- 2368,2376 ----
  		     (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.
============================================================

  reply	other threads:[~2004-07-25  2:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-11 16:34 (tramp-handleverify-visited-file-modtime Luc Teirlinck
2004-07-11 16:42 ` (tramp-handleverify-visited-file-modtime Luc Teirlinck
2004-07-11 17:06 ` (tramp-handleverify-visited-file-modtime Luc Teirlinck
2004-07-11 17:35   ` (tramp-handleverify-visited-file-modtime Luc Teirlinck
2004-07-24 18:46 ` (tramp-handleverify-visited-file-modtime Michael Albinus
2004-07-25  2:11   ` Luc Teirlinck [this message]
2004-07-25 11:00     ` (tramp-handleverify-visited-file-modtime Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200407250211.i6P2B1j28553@raven.dms.auburn.edu \
    --to=teirllm@dms.auburn.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.