From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: testing for a remote file to include file on a Windows mapped drive Date: Sat, 26 Jan 2008 12:07:53 +0200 Message-ID: References: Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1201342114 22168 80.91.229.12 (26 Jan 2008 10:08:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 26 Jan 2008 10:08:34 +0000 (UTC) Cc: emacs-devel@gnu.org To: "Drew Adams" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 26 11:08:54 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JIhxX-0007yB-TY for ged-emacs-devel@m.gmane.org; Sat, 26 Jan 2008 11:08:24 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JIhx7-00019B-70 for ged-emacs-devel@m.gmane.org; Sat, 26 Jan 2008 05:07:57 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JIhx1-000187-8x for emacs-devel@gnu.org; Sat, 26 Jan 2008 05:07:51 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JIhwz-000164-4X for emacs-devel@gnu.org; Sat, 26 Jan 2008 05:07:50 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JIhwy-00015o-VR for emacs-devel@gnu.org; Sat, 26 Jan 2008 05:07:49 -0500 Original-Received: from heller.inter.net.il ([213.8.233.23]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JIhwy-0008H1-I0 for emacs-devel@gnu.org; Sat, 26 Jan 2008 05:07:48 -0500 Original-Received: from HOME-C4E4A596F7 (IGLD-80-230-250-87.inter.net.il [80.230.250.87]) by heller.inter.net.il (MOS 3.7.3a-GA) with ESMTP id ETS61903 (AUTH halo1); Sat, 26 Jan 2008 12:07:45 +0200 (IST) In-reply-to: X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.7-5.2 (or MacOS X 10.2-10.4) (2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:87560 Archived-At: > From: "Drew Adams" > Date: Fri, 25 Jan 2008 10:47:51 -0800 > > I have some code that needs to avoid some particular processing when the > current input might name a remote file. I don't want the code to try to > contact anything remote in this case. > > In Windows, you can map a remote directory to a virtual drive. So, for > instance, "h:foo" or "h:/foo" might represent a remote file. But the same > name would represent a local file if drive `h' is local, not mapped. > > How can I test in Emacs, for Windows, whether a drive is local or mapped, in > order to determine whether "h:foo" might be local or remote? Does it help to run "net use" and parse its output? Note that "net use" itself might be somewhat slow, but maybe your undisclosed processing would be much slower than that, in which case "net use" is justified. > I've looked at these. None does what I need. > > . file-remote-p > . ffap-file-remote-p > . dired-sort-menu-remote-p > "\\`/\\([^@:/]+@\\)?\\([^:/]+\\):" > . ange-ftp-name-format > "\\`/\\(\\([^/:]*\\)@\\)?\\([^@/:]*[^@/:.]\\):\\(.*\\)" > . remote (ange-ftp) filenames (see make-auto-save-file-name) > "^/\\w+@[-A-Za-z0-9._]+:" > . ffap-ftp-regexp > "\\`/[^/:]+:" These all make sense only in the context of the features that define them. In general, Emacs does not consider files on a mounted volume to be remote. The notion of remote files is in conjunction with Emacs features that access files in ways that are not the normal filesystem APIs. It sounds like you want something entirely different, but it's hard to say what that is without knowing what are you trying to accomplish, and why applying that to remote files would be wrong.