From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: testing for a remote file to include file on a Windows mappeddrive Date: Mon, 04 Feb 2008 16:55:01 -0500 Message-ID: References: <871w844yff.fsf@gmx.de> <87bq781bf7.fsf@gmx.de> <86zlun5mg0.fsf@lola.quinscape.zz> <8763xbf5yy.fsf@gmx.de> <87lk62b1qq.fsf@gmx.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1202162137 3532 80.91.229.12 (4 Feb 2008 21:55:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 Feb 2008 21:55:37 +0000 (UTC) Cc: emacs-devel@gnu.org, rms@gnu.org, drew.adams@oracle.com, jasonr@gnu.org To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 04 22:55:57 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 1JM9I6-0002JK-Ae for ged-emacs-devel@m.gmane.org; Mon, 04 Feb 2008 22:55:50 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JM9He-0007S7-2c for ged-emacs-devel@m.gmane.org; Mon, 04 Feb 2008 16:55:22 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JM9HX-0007RC-W5 for emacs-devel@gnu.org; Mon, 04 Feb 2008 16:55:16 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JM9HW-0007R0-It for emacs-devel@gnu.org; Mon, 04 Feb 2008 16:55:15 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JM9HW-0007Qx-Fv for emacs-devel@gnu.org; Mon, 04 Feb 2008 16:55:14 -0500 Original-Received: from ironport2-out.pppoe.ca ([206.248.154.182]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JM9HL-00071o-MF; Mon, 04 Feb 2008 16:55:03 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAAwYp0fO+J95dGdsb2JhbACQJwEwnCWBAg X-IronPort-AV: E=Sophos;i="4.25,304,1199682000"; d="scan'208";a="13627728" Original-Received: from smtp.pppoe.ca ([65.39.196.238]) by ironport2-out.pppoe.ca with ESMTP; 04 Feb 2008 16:55:01 -0500 Original-Received: from pastel.home ([206.248.159.121]) by smtp.pppoe.ca (Internet Mail Server v1.0) with ESMTP id KXH87501; Mon, 04 Feb 2008 16:55:01 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 66C0B7F47; Mon, 4 Feb 2008 16:55:01 -0500 (EST) In-Reply-To: <87lk62b1qq.fsf@gmx.de> (Michael Albinus's message of "Sun, 03 Feb 2008 14:36:45 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. 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:88199 Archived-At: > unhandled-file-name-directory is something that shall provide > `call-process' and `start-process' with a suitable default > directory. That's why Tramp always returns "~/", and ange-ftp does > "/tmp/". It doesn't look like it is usable in the `process-file' and > `start-file-process' cases. It's not needed for process-file and start-file-process. > file-relative-name might be sufficient in obvious cases: > (file-relative-name "/sudo::/var/syslog/syslog.log" "/sudo::") > => "../var/syslog/syslog.log" > But: > (file-relative-name "/sudo::/var/syslog/syslog.log" "/ssh::") > => "/sudo:root@arthur:/var/syslog/syslog.log" > This is correct, but inconvenient. No, it's very convenient: file-name-absolute-p will then tell you if the process can reach those files. >> I suggest to change unhandled-file-name-directory so that it can (and >> should) return nil if the named file/directory cannot be >> directly accessed. > ... from a local subprocess. It shall not be used for default > directories of `process-file' and `start-file-process'. Yes, indeed, I'm only concerned about call-process and start-process. >> And then let users of unhandled-file-name-directory >> default to "~/" if it returned nil. Then we can define file-local-name >> as follows: >> >> (defun file-local-name/unhandled-file-name (file) >> (setq file (expand-file-name file)) >> (let ((dir (unhandled-file-name-directory file))) >> (if file (expand-file-name (file-name-nondirectory file) dir)))) >> >> or alternatively, we can add file-local-name/unhandled-file-name and >> drop unhandled-file-name-directory (which can be defined then as >> >> (defun unhandled-file-name-directory (file) >> (unhandled-file-name (file-name-directory (expand-file-name >> file)))) > I agree. It doesn't make sense for Tramp and ange-ftp, guessing what > might be a good default directory for `call-process' and `start-process'. > They shall simply apply `ignore'; alternatively it shall not be called > per file-name-handler. Not all file handlers are like Tramp: jka-compr and several others only modify the way files are accessed, rather than providing access to more files. So it still needs to be a file-name-handler. Stefan