emacs-devel
[Top][All Lists]
Advanced

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

RE: testing for a remote file to include file on a Windows mapped drive


From: Drew Adams
Subject: RE: testing for a remote file to include file on a Windows mapped drive
Date: Mon, 21 Apr 2008 00:55:57 -0700

> > As you said, the purpose of file-remote-p is to determine, 
> > without the cost of a remote access, whether a file name
> > represents a remote file. The aim in using it
> > is to be able to know that a file is remote, so you might 
> > then avoid the cost of accessing it.
> >
> > * A file on a Windows mapped network drive is remote, in 
> >   the sense of incurring a performance penalty for access.
> >   `file-remote-p' should return non-nil for such a file,
> >   but nil for a file on a Windows local drive. That is not
> >   the case now.
> 
> I believe, we are speaking about 2 different functions:
> 
> * file-remote-p returns t, if a file is not directly accessible by
>   underlying operating system's means. Such files always need some
>   special file name handler functions in Emacs for proper
>   handling. Such (absolute) file names cannot be used literally
>   outside functions, which support file name handlers.
> 
> * file-mounted-p (as working name) returns t, if a file looks like an
>   ordinary file from the operating system's point of view, but its
>   physical location is on another machine. Examples are nfs, smbfs or
>   sshfs mounts under GNU/Linux, or network shares under W32. This
>   property cannot be detected by file name handler functions. The
>   implementation shall be in the C core.
> 
> These functions are exclusive: file-remote-p and file-mounted-p shall
> not return t for the same filename. Since one function uses the
> filename only for checking the result, and the other function uses
> operating system properties, I don't believe it makes sense to merge
> them into one function.
> 
> A test for "slow access" is therefore
> 
> (or (file-mounted-p filename)
>     (file-remote-p filename))

I see. I wasn't aware of `file-mounted-p'.
I don't see it in my January build of Emacs 23.
 
> > So if ffap-ftp-regexp is subsumed by an ange-ftp test, the 
> > question becomes whether that ange-ftp test should be
> > included in `file-remote-p'.
> 
> The relevant test for ange-ftp is included in file-remote-p.

I guessed that. But in that case, perhaps it should be included at an earlier
stage, so that the performance (as shown by your tests) reflects that of
`ffap-ftp-regexp'.

My question was really about my code - whether I still need to use both tests. I
guess the answer is yes, at least for now; if not for pattern completeness
(coverage), at least for performance (try the ffap patterns first).






reply via email to

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