emacs-devel
[Top][All Lists]
Advanced

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

Re: file-relative-name and remote files


From: Kai Großjohann
Subject: Re: file-relative-name and remote files
Date: Sun, 23 Feb 2003 12:03:39 +0100
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.3.50

Lars Hansen <address@hidden> writes:

> file-relative-name assumes that filename and directory is part of the
> same tree except when we are on a DOS/Windows system and the first two
> chars in the expanded file names (the drive) are not equal. This
> approach does not work with remote files. With remote files filename
> and directory may reside in different trees. Since the syntax of
> remote files just is a prefix to an ordinary file name, it should be a
> matter of comparing prefixes, just as in the DOS/Windows
> case. However, remote files are handled by the file name handler
> mechanism which does not work for file-relative-name, since
> file-relative-name is a lisp function.
>
> What would be the best way to solve this problem?

Whee.  Good spotting.  IMHO, the following might work:

file-relative-name finds a filename handler for the filename and one
for the directory.  If they are different, then the two must come
from different handlers, so do like the different-drives case.  If
they are equal, invoke the handler.

This requires a new file operation, file-relative-name.  It seems to
work for Ange-FTP and Tramp.  However...

Imagine that there was a filename handler which could look inside of
tar files, so that the filename /tmp/foo.tar/x/y would extract the
file x/y from the tarball /tmp/foo.tar.  So should
(file-relative-name "/tmp/foo.tar/x/y" "/tmp") eval to "foo.tar/x/y"
or not?
-- 
A preposition is not a good thing to end a sentence with.





reply via email to

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