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

View: Old framed views
135 Messages — Rating Filter:   Alert me  
testing for a remote file to include file on a Windows mapped drive - I have some code that needs to avoid some particular processing when the current input might name a remote file. I... Loading...
I should have mentioned that all I've come up with for this so far is this: (and (memq system-type '(ms-dos... Loading...
RE: testing for a remote file to include file on a Windows mappeddrive - > Is there some way to ask Windows (from Emacs) whether a drive letter is > mapped or local? In the absence of any... Loading...
Re: testing for a remote file to include file on a Windows mappeddrive - Drew Adams wrote: > Googling showed that local drive vs mapped network drive can be tested, in > C# at least (using... Loading...
RE: testing for a remote file to include file on a Windows mappeddrive - > > Googling showed that local drive vs mapped network drive can be > > tested, in C# at least (using GetDriveType()... Loading...
Re: testing for a remote file to include file on a Windows mappeddrive - > Also, IIUC, `file-remote-p' isn't only boolean; the non-nil return value > means something. I don't know what should... Loading...
Stefan Monnier <monnier@...> writes: > (let ((file-name-handlers-alist nil)) (file-readable-p... Loading...
>> (let ((file-name-handlers-alist nil)) (file-readable-p <FILE>)). > (and (not (file-remote-p file))... Loading...
Stefan Monnier <monnier@...> writes: >> file-remote-p returns information about the *file name*, and... Loading...
RE: testing for a remote file to include file on a Windows mappeddrive - > But we shall come back to the original request of Drew: he wants to know > whether a given file is "remote",... Loading...
RE: testing for a remote file to include file on a Windows mapped drive - I'm returning to this thread because I don't know what was finally done wrt what I asked for in starting the thread:... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - > Could someone please summarize what was done about this? Nothing. Stefan Loading...
RE: testing for a remote file to include file on a Windows mapped drive - > > Could someone please summarize what was done about this? > > Nothing. OK, thanks for the prompt reply.... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - >> > Could someone please summarize what was done about this? >> Nothing. > Could you (someone) explain why nothing... Loading...
RE: testing for a remote file to include file on a Windows mapped drive - > >> > Could someone please summarize what was done about this? > >> Nothing. > > > Could you (someone) explain why... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - >> > Could you (someone) explain why nothing was done? Was it because it >> > was decided that: It was a silly problem... Loading...
RE: testing for a remote file to include file on a Windows mapped drive - > >> AFAIK, it's a difficult problem, and it's not very high up on the > >> priority. > > I see. Would it help for me... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - "Drew Adams" <drew.adams@...> writes: > As you said, the purpose of file-remote-p is to determine, without the... Loading...
> * file-remote-p returns t, if a file is not directly accessible by > underlying operating system's means. Such... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - > From: Stefan Monnier <monnier@...> > Date: Mon, 21 Apr 2008 10:33:57 -0400 > Cc: 'Emacs-Devel'... Loading...
> So a file that does not have a handler is _never_ remote. That's irrelevant: look at the uses, and you'll see that... Loading...
Stefan Monnier <monnier@...> writes: >> So a file that does not have a handler is _never_ remote. > >... Loading...
> I have available a checkout from April 7th. Scanning lisp/*, there are > 40 places file-remote-p is called. Let's not... Loading...
> From: Stefan Monnier <monnier@...> > Cc: Eli Zaretskii <eliz@...>, emacs-devel@..., ... Loading...
>> I just have noticed several different concerns that tend to be >> conflated: >> - reliability and performance. >>... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - > X-Spam-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00, > FORGED_RCVD_HELO,SPF_SOFTFAIL,UNPARSEABLE_RELAY... Loading...
>> >> I just have noticed several different concerns that tend to be >> >> conflated: >> >> - reliability and... Loading...
RE: testing for a remote file to include file on a Windows mapped drive - > >> >> I just have noticed several different concerns that tend to be > >> >> conflated: > >> >> - reliability and... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - > `file-remote-p' is also slower than it could be, at least for some > file names. For file names that... Loading...
RE: testing for a remote file to include file on a Windows mapped drive - > > `file-remote-p' is also slower than it could be, at least for some > > file names. For file names that... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - "Drew Adams" <drew.adams@...> writes: > `file-remote-p' already tests using some regexps - why not add the... Loading...
>> `file-remote-p' already tests using some regexps - why not add the ffap >> regexp(s)? You already agreed to that, in... Loading...
RE: testing for a remote file to include file on a Windows mapped drive - > > I offered to describe my use case, but it won't prove > > anything special in this regard. Suffice it to say... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - "Drew Adams" <drew.adams@...> writes: >> > I offered to describe my use case, but it won't prove >> >... Loading...
RE: testing for a remote file to include file on a Windows mapped drive - > >> > I offered to describe my use case, but it won't prove > >> > anything special in this regard. Suffice it to say... Loading...
Stefan Monnier <monnier@...> writes: > I have no idea which change you're talking about. > I just have... Loading...
> There are also `ediff-file-remote-p' and `ffap-file-remote-p', but > they are not called from `file-remote-p'; they... Loading...
> From: Stefan Monnier <monnier@...> > Cc: michael.albinus@..., emacs-devel@..., ... Loading...
>> This may require some changes in file-relative-name, because this one >> does use file-remote-p in a more specific... Loading...
> From: Stefan Monnier <monnier@...> > Cc: michael.albinus@..., emacs-devel@..., ... Loading...
Stefan Monnier <monnier@...> writes: Hi Stefan, >> * file-remote-p returns t, if a file is not... Loading...
> I just see this function from a practical point of view, providing an > implementation for a special case (Tramp... Loading...
Stefan Monnier <monnier@...> writes: > I know it started as a file-name-handler-only thingy, but its... Loading...
> that's not the only use case for file-remote-p. This function is used > also in cases for the decision "Do I need... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - > From: Michael Albinus <michael.albinus@...> > Date: Mon, 21 Apr 2008 09:46:48 +0200 > Cc: 'Emacs-Devel'... Loading...
Eli Zaretskii <eliz@...> writes: >> * file-mounted-p (as working name) returns t, if a file looks like an >> ... Loading...
Michael Albinus <michael.albinus@...> writes: > * file-mounted-p (as working name) returns t, if a file looks like... Loading...
Andreas Schwab <schwab@...> writes: > Michael Albinus <michael.albinus@...> writes: > >> * file-mounted-p... Loading...
> I would prefer a function which returns "fast" or "slow". We have that. It's called `file-remote-p': A file... Loading...
RE: testing for a remote file to include file on a Windows mapped drive - > > I would prefer a function which returns "fast" or "slow". > > We have that. It's called `file-remote-p': > > ... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - >> That's what ffap-rfs-regexp tries to do. And yes, I think it >> should be added to file-remote-p. > It sounds... Loading...
RE: testing for a remote file to include file on a Windows mapped drive - > >> That's what ffap-rfs-regexp tries to do. And yes, I think it > >> should be added to file-remote-p. > > > It... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - >> >> That's what ffap-rfs-regexp tries to do. And yes, I think it >> >> should be added to file-remote-p. >> >> >... Loading...
RE: testing for a remote file to include file on a Windows mapped drive - > >> >> That's what ffap-rfs-regexp tries to do. And yes, I think it > >> >> should be added to file-remote-p. > >>... Loading...
Michael Albinus <michael.albinus@...> writes: > One could consider additional regexps, which tell "when the... Loading...
Andreas Schwab <schwab@...> writes: > Michael Albinus <michael.albinus@...> writes: > >> One could consider... Loading...
Michael Albinus <michael.albinus@...> writes: > One could offer to check for filesystem types, like udf or... Loading...
RE: testing for a remote file to include file on a Windows mapped drive - > > As you said, the purpose of file-remote-p is to determine, > > without the cost of a remote access, whether a file... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - "Drew Adams" <drew.adams@...> writes: > I see. I wasn't aware of `file-mounted-p'. > I don't see it in my... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - Drew Adams wrote: > As you said, the purpose of file-remote-p is to determine, without the cost of a > remote... Loading...
RE: testing for a remote file to include file on a Windows mapped drive - > > As you said, the purpose of file-remote-p is to determine, > > without the cost of a remote access, whether a file... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - > From: "Drew Adams" <drew.adams@...> > Date: Mon, 21 Apr 2008 00:47:05 -0700 > Cc: 'Michael Albinus'... Loading...
RE: testing for a remote file to include file on a Windows mapped drive - > > Whether I access a local Windows drive (even a slow one) or > > a Windows mapped network drive that happens to be... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - > From: "Drew Adams" <drew.adams@...> > Cc: <jasonr@...>, <michael.albinus@...>,... Loading...
RE: testing for a remote file to include file on a Windows mapped drive - > > > > Whether I access a local Windows drive (even a slow one) or > > > > a Windows mapped network drive that... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - > From: "Drew Adams" <drew.adams@...> > Cc: <jasonr@...>, <michael.albinus@...>,... Loading...
RE: testing for a remote file to include file on a Windowsmapped drive - > This is a 3-fold slowdown for a networked volume, and accessing 11 > directories with a plethora of file I/O APIs... Loading...
Re: testing for a remote file to include file on a Windowsmapped drive - > From: "Drew Adams" <drew.adams@...> > Cc: <emacs-devel@...>, <michael.albinus@...>, > ... Loading...
RE: testing for a remote file to include file on a Windows mapped drive - > > As you said, the purpose of file-remote-p is to determine, > > without the cost of a remote access, whether a file... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - > From: "Drew Adams" <drew.adams@...> > Date: Sun, 20 Apr 2008 13:24:52 -0700 > Cc: 'Emacs-Devel'... Loading...
RE: testing for a remote file to include file on a Windows mapped drive - > > Could you (someone) explain why nothing was done? > > My impression was that the problem was not deemed important... Loading...
Stefan Monnier wrote: >> Could someone please summarize what was done about this? > > Nothing. Is... Loading...
Lennart Borgman (gmail) wrote: > Is WNetGetConnection useful for this? (There is already code calling > this function... Loading...
> Date: Sun, 20 Apr 2008 22:03:53 +0200 > From: "Lennart Borgman (gmail)" <lennart.borgman@...> > Cc: 'Jason... Loading...
Eli Zaretskii wrote: >> Is WNetGetConnection useful for this? > > What for? GetDriveType is perfectly capable of... Loading...
>>> Could someone please summarize what was done about this? >> Nothing. Actually, this is not quite right: nothing... Loading...
Re: testing for a remote file to include file on a Windows mappeddrive - > I think Stefan suggested something similar for symbolic links on other > platforms. No, not for symbolic links,... Loading...
>> I suggest we clarify the meaning of file-remote-p to explain that it >> returns info that relates to the time and... Loading...
Stefan Monnier <monnier@...> writes: > Anyway, any objection to my proposal to clarify file-remote-p's... Loading...
`file-local-name' might not be a good name. The operation `unhandled-file-name-directory' returns a directory... Loading...
Richard Stallman <rms@...> writes: > `file-local-name' might not be a good name. > > The operation... Loading...
Re: testing for a remote file to include file on a Windows mappeddrive - > As usual, I don't care function names too much. But the mapping > (nonmagic-file-name "/sudo::") => "/root" >... Loading...
Stefan Monnier <monnier@...> writes: >> As usual, I don't care function names too much. But the... Loading...
>>> As usual, I don't care function names too much. But the mapping >> >>> (nonmagic-file-name "/sudo::") =>... Loading...
Stefan Monnier <monnier@...> writes: > I don't see the problem: Tramp should simply always return... Loading...
>> I don't see the problem: Tramp should simply always return nil. >> That's fine. The code (doc-view) will than... Loading...
Stefan Monnier <monnier@...> writes: > For the "/:" file-name handler, file-remote-p should return nil,... Loading...
>> For the "/:" file-name handler, file-remote-p should return nil, and >> unhandled-file-name should return the... Loading...
Stefan Monnier <monnier@...> writes: > Hmm... I see your point and now I'm not so sure about the... Loading...
> unhandled-file-name-directory is something that shall provide > `call-process' and `start-process' with a suitable... Loading...
Stefan Monnier <monnier@...> writes: >> But: > >> (file-relative-name... Loading...
> There might be cases where this is still not sufficient. Think about a > Samba server, which offers several "shares"... Loading...
url-handler-file-remote-p (was: testing for a remote file to include file on a Windows mappeddrive) - Stefan Monnier <monnier@...> writes: >> Just being curious: url-handlers.el misses an own implementation... Loading...
Re: url-handler-file-remote-p - >>> Just being curious: url-handlers.el misses an own implementation of >>> `file-remote-p'; shouldn't it be there? >>... Loading...
Stefan Monnier <monnier@...> writes: >> What about this one: > > Looks good. (Slightly different)... Loading...
Stefan Monnier <monnier@...> writes: >> There might be cases where this is still not sufficient. Think... Loading...
> Just that your proposal (use file-relative-name for trimming arguments > of remote subprocesses) works only, if the... Loading...
Stefan Monnier <monnier@...> writes: > Welcome to this thread, which started around the discussion of... Loading...
Stefan Monnier <monnier@...> writes: >> As usual, I don't care function names too much. But the... Loading...
> I'm lost. What do you expect as result of (nonmagic-file-name "/sudo::") ? nil because this directory is (most... Loading...
Stefan Monnier <monnier@...> writes: >> I'm lost. What do you expect as result of (nonmagic-file-name... Loading...
>>> I'm lost. What do you expect as result of (nonmagic-file-name "/sudo::") ? >> nil >> because this directory is... Loading...
> `file-local-name' might not be a good name. > The operation `unhandled-file-name-directory' returns a directory... Loading...
> `file-local-name' might not be a good name. > The operation `unhandled-file-name-directory' returns a... Loading...
>> `file-local-name' might not be a good name. >> The operation `unhandled-file-name-directory' returns a directory... Loading...
> The issue is not whether the returned file name is magic or not, but > whether it can be passed as-is... Loading...
>> I think the same goes for `unhandled-file-name'. > I don't understand. unhandled-file-name-directory is used to... Loading...
> From: Michael Albinus <michael.albinus@...> > Date: Sat, 26 Jan 2008 23:15:08 +0100 > Cc: Jason Rumney... Loading...
Eli Zaretskii <eliz@...> writes: >> Rough idea: maybe one could use the device number, returned as last >>... Loading...
> From: Michael Albinus <michael.albinus@...> > Cc: monnier@..., jasonr@..., ... Loading...
Eli Zaretskii <eliz@...> writes: > Are you saying that files with device number below a certain threshold > are... Loading...
Eli Zaretskii <eliz@...> writes: > Are you saying that files with device number below a certain threshold > are... Loading...
RE: testing for a remote file to include file on a Windows mappeddrive - > file-remote-p returns information about the *file name*, and not > necessarily about the file: "Can the file name be... Loading...
Re: testing for a remote file to include file on a Windows mappeddrive - Michael Albinus wrote: > Stefan Monnier <monnier@...> writes: > > >> (let ((file-name-handlers-alist... Loading...
Re: testing for a remote file to include file on a Windows mappeddrive - Stefan Monnier wrote: > It all depends what you want to know. In doc-view, we recently tried to > use file-remote-p... Loading...
RE: testing for a remote file to include file on a Windows mappeddrive - > > Also, IIUC, `file-remote-p' isn't only boolean; the non-nil return value > > means something. I don't know what... Loading...
Re: testing for a remote file to include file on a Windows mappeddrive - > From: "Drew Adams" <drew.adams@...> > Date: Fri, 25 Jan 2008 23:30:54 -0800 > Cc: Emacs-Devel... Loading...
Re: testing for a remote file to include file on a Windows mappeddrive - >>>>> "Drew" == Drew Adams <drew.adams@...> writes: >> GetDriveType can be called from C. Emacs already... Loading...
Eric Hanchrow <offby1@...> writes: > _I_ sure wish it did. I like using global-auto-revert-mode, but that >... Loading...
RE: testing for a remote file to include file on aWindows mappeddrive - > > _I_ sure wish it did. I like using global-auto-revert-mode, > > but that can make Emacs hang when it checks a... Loading...
Re: testing for a remote file to include file on aWindows mappeddrive - > `file-mounted-p', and you then test with (or ...) to see if there is > a possible slowdown, or we put the tests into... Loading...
RE: testing for a remote file to include file on aWindows mappeddrive - > > `file-mounted-p', and you then test with (or ...) to see if there is > > a possible slowdown, or we put the tests... Loading...
Re: testing for a remote file to include file on aWindows mappeddrive - > 3. Do #1 and perhaps rename `file-remote-p'. My quoting the docstring was specifically to explain that we... Loading...
RE: testing for a remote file to include file on aWindows mappeddrive - > > 3. Do #1 and perhaps rename `file-remote-p'. > > My quoting the docstring was specifically to explain that we... Loading...
Re: testing for a remote file to include file on aWindows mappeddrive - > In any case, please let me know what you have in mind for the patch. The reason why I don't write the patch is to... Loading...
Re: testing for a remote file to include file on aWindows mappeddrive - "Drew Adams" <drew.adams@...> writes: > The expressed need is to know whether accessing a file with a given... Loading...
RE: testing for a remote file to include file on aWindows mappeddrive - > > The expressed need is to know whether accessing a file with > > a given name might be significantly slower than... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - > From: "Drew Adams" <drew.adams@...> > Date: Fri, 25 Jan 2008 10:54:36 -0800 > > I should have mentioned... Loading...
> From: "Drew Adams" <drew.adams@...> > Date: Fri, 25 Jan 2008 10:47:51 -0800 > > I have some code that needs... Loading...
RE: testing for a remote file to include file on a Windows mapped drive - > > . file-remote-p > > . ffap-file-remote-p > > . dired-sort-menu-remote-p > > ... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - > From: "Drew Adams" <drew.adams@...> > Cc: <emacs-devel@...> > Date: Sat, 26 Jan 2008 08:55:48 -0800 >... Loading...
RE: testing for a remote file to include file on a Windows mapped drive - > > As I said, I want to know if a file name is likely to represent a remote > > file (in the Emacs sense you cited) or... Loading...
Re: testing for a remote file to include file on a Windows mapped drive - > From: "Drew Adams" <drew.adams@...> > Cc: <emacs-devel@...> > Date: Sat, 26 Jan 2008 09:57:17 -0800 >... Loading...
> I have some code that needs to avoid some particular processing when the > current input might name a remote file. I... Loading...
> From: Stefan Monnier <monnier@...> > Date: Fri, 25 Jan 2008 17:11:45 -0500 > Cc: Emacs-Devel... Loading...