emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tramp file modification time for not yet existing files.


From: Kai Grossjohann
Subject: Re: Tramp file modification time for not yet existing files.
Date: Sun, 18 Jul 2004 20:59:51 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

Luc Teirlinck <address@hidden> writes:

> If one creates a buffer visiting a not yet existing file on a remote
> machine using Tramp, then `visited-file-modtime' originally (before
> the file is saved) returns 0.  The return value for local files in
> the same situation is (-1 65535), that is, -1.

I'm afraid that I'm just before a deadline at work at the moment, so
if you already know what needs to happen, it would be wonderful if
you could just do it.  Since the stable Tramp branch and Emacs are
now in sync, it will be easy to merge changes.

Otherwise, it might take me a couple of weekends before I have time
to look at this again.

> After that we would get another problem.
>
>            ;; If file does not exist, say it is not modified.
>               (t nil)))))))

It appears that the comment here says what should happen, but the
code does the wrong thing.  So changing the nil to t is one change
that seems to be necessary.

But I don't know what else is needed.

> If the file does not exist and never existed, the return value needs
> to be t  (unless the error is "untame"):
>
>       /* If the file doesn't exist now and didn't exist before,
>        we say that it isn't modified, provided the error is a tame
>        one.  */
>       if (errno == ENOENT || errno == EACCES || errno == ENOTDIR)
>       st.st_mtime = -1;
>       else
>       st.st_mtime = 0;
>
> If the file no longer exists, but the buffer's record believes it
> still does, the return value should be nil.
>
> Once Tramp sets the modtime to -1, it is easy to take care of all
> this, except maybe for the "provided the error is a tame one" part.  I
> do not know how relevant that part is, nor whether it is easy to check
> from Lisp.

What confuses me most is your wording of "setting the modtime".  I
think I misread it as "getting", and then I started to look for the
function visited-file-modtime, which is not a file operation...  Of
course, the misunderstanding is entirely my fault.

Do you mean that tramp-handle-set-visited-file-modtime should set the
modtime to -1 if no time has been specified and the file does not
exist?

I think Tramp now uses (0 0) for those cases.

Does Ange-FTP need a similar change?  Tramp uses (0 0) as a dont-know
value because Ange-FTP does it, and I didn't understand the issues at
that time.

Kai




reply via email to

[Prev in Thread] Current Thread [Next in Thread]