unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kai Grossjohann <kai@emptydomain.de>
Cc: kai@emptydomain.de, emacs-devel@gnu.org
Subject: Re: Tramp file modification time for not yet existing files.
Date: Sun, 18 Jul 2004 20:59:51 +0200	[thread overview]
Message-ID: <868ydhkuoo.fsf@rumba.de.uu.net> (raw)
In-Reply-To: <200407121917.i6CJHMU00559@raven.dms.auburn.edu> (Luc Teirlinck's message of "Mon, 12 Jul 2004 14:17:22 -0500 (CDT)")

Luc Teirlinck <teirllm@dms.auburn.edu> 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

  parent reply	other threads:[~2004-07-18 18:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-12 19:17 Tramp file modification time for not yet existing files Luc Teirlinck
2004-07-13  2:40 ` Luc Teirlinck
2004-07-18 18:59 ` Kai Grossjohann [this message]
2004-07-18 20:12   ` Luc Teirlinck
2004-07-24 18:48 ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=868ydhkuoo.fsf@rumba.de.uu.net \
    --to=kai@emptydomain.de \
    --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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).