unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* tramp-handle-file-newer-than-file-p
@ 2002-08-15 15:42 Mario Lang
  2002-08-17 19:10 ` tramp-handle-file-newer-than-file-p Kai Großjohann
  0 siblings, 1 reply; 2+ messages in thread
From: Mario Lang @ 2002-08-15 15:42 UTC (permalink / raw)


Hello.

I've just tried a very cool thing, and it actually worked, but only have way :/.

Well, emacs-wiki.el can publish a set of wikipages as html.  Now,
WIBNI this worked with a Tramp path as publishing-directory?

Actually, it does!  But only for the first time you publish.

emacs-wiki does the obvious thing, it checks if the wikifile is newer than
the published version, so it does:

file-newer-than-file-p("/home/mlang/debian/notes/BrlTty"
                       "/[su/xxx@xxx.x.org]/home/xxx/public_html/BrlTty.html")

It tries to compare the dates of a local and a remote file.

But said function explicitly prevents that:

(defun tramp-handle-file-newer-than-file-p (file1 file2)
  "Like `file-newer-than-file-p' for tramp files."
  (cond ((not (file-exists-p file1))
         nil)
        ((not (file-exists-p file2))
         t)
        ;; We are sure both files exist at this point.  We assume that
        ;; both files are Tramp files, otherwise we issue an error
        ;; message.

Is it really necessary to do that?  Can't we just compare them here.  If
yes, that would be really great for emacs-wiki publishing :).

And for all other cases where file-newer-than-file-p may compare
a local and a remote file.

-- 
CYa,
  Mario

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: tramp-handle-file-newer-than-file-p
  2002-08-15 15:42 tramp-handle-file-newer-than-file-p Mario Lang
@ 2002-08-17 19:10 ` Kai Großjohann
  0 siblings, 0 replies; 2+ messages in thread
From: Kai Großjohann @ 2002-08-17 19:10 UTC (permalink / raw)
  Cc: emacs-devel

Mario Lang <mlang@debian.org> writes:

> But said function explicitly prevents that:
>
> (defun tramp-handle-file-newer-than-file-p (file1 file2)
>   "Like `file-newer-than-file-p' for tramp files."
>   (cond ((not (file-exists-p file1))
>          nil)
>         ((not (file-exists-p file2))
>          t)
>         ;; We are sure both files exist at this point.  We assume that
>         ;; both files are Tramp files, otherwise we issue an error
>         ;; message.
>
> Is it really necessary to do that?  Can't we just compare them here.  If
> yes, that would be really great for emacs-wiki publishing :).

Tramp does not always know the modtime of the remote file, and
comparing a local and a remote file needs the modtime.

Some time later, support was added to Tramp so that it knows the
modtime of a remote file in some cases, but I was too lazy to update
tramp-handle-file-newer-than-file-p accordingly.  I figured that
people would complain if they needed it :-)

Why does Tramp not always know the modtime?  Because I didn't know of
a portable way to find it.  "ls -l" prints something but it's not the
exact time and it's not clear which way to err.

Why does Tramp sometimes know the modtime?  Because Tramp looks for
Perl on the remote end, and Perl can tell the modtime.

How can Tramp compare modtimes without knowing them?  Because some
"test" implementations have a newer-than test built-in, and for the
others, a kludge involving "find" can be used.

kai
-- 
A large number of young women don't trust men with beards.  (BFBS Radio)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-08-17 19:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-15 15:42 tramp-handle-file-newer-than-file-p Mario Lang
2002-08-17 19:10 ` tramp-handle-file-newer-than-file-p Kai Großjohann

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).