[Top][All Lists]

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

Re: testing for a remote file to include file on a Windows mappeddrive

From: Stefan Monnier
Subject: Re: testing for a remote file to include file on a Windows mappeddrive
Date: Sat, 26 Jan 2008 14:24:10 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

>> (let ((file-name-handlers-alist nil)) (file-readable-p <FILE>)).

> (and (not (file-remote-p file)) (file-readable-p file))

> There could be file name handlers, which have an own implementation of
> file-readable-p for local files.

>> I think file-remote-p should really give a kind of performance and
>> reliability info: is the file available from local (i.e. fast and
>> reliable) storage, or is it only available via a network access which
>> may be slow and may fail.

> file-remote-p returns information about the *file name*, and not
> necessarily about the file: "Can the file name be used literally on the
> local host?" I believe this meaning shall be kept, for example, it is
> needed to determine whether a file name must be trimmed when used as
> argument of process-file and alike.

> The new function you are looking for is file-mounted-p or so.

I believe you're wrong and I'm right ;-)

What you consider as the meaning of `file-remote-p' is pretty close to
the info returned by (let ((file-name-handlers-alist nil)) (not
(file-readable-p <FILE>))), whereas what you want to call
`file-mounted-p' is much closer to what `file-remote-p' currently does.

E.g. (file-remote-p "/:/") will return nil, even though passing "/:/" as
an argument to a subprocess will likely fail to do what was intended.

After all, whether the filename can be passed to a subprocess has
nothing to do with whether or not it's "remote".

I suggest we clarify the meaning of file-remote-p to explain that it
returns info that relates to the time and reliability of the access to
this file.  And we introduce a new one `unhandled-file-name' which
returns either "an equivalent name that can passed to subprocesses"
(e.g. for the "/:/" file-name-handler, it just strips the leading "/:"
and similarly for the "file://" one) or nil if the file cannot be
directly accessed by a subprocess (either because it's only accessible
via ssh/ftp/tar/younameit it by a file-name-handler).


reply via email to

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