From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: testing for a remote file to include file on a Windows mappeddrive Date: Sun, 03 Feb 2008 14:36:45 +0100 Message-ID: <87lk62b1qq.fsf@gmx.de> References: <871w844yff.fsf@gmx.de> <87bq781bf7.fsf@gmx.de> <86zlun5mg0.fsf@lola.quinscape.zz> <8763xbf5yy.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 1202045576 28946 80.91.229.12 (3 Feb 2008 13:32:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Feb 2008 13:32:56 +0000 (UTC) Cc: emacs-devel@gnu.org, rms@gnu.org, drew.adams@oracle.com, jasonr@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 03 14:33:17 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 1JLeyB-0001Sb-2c for ged-emacs-devel@m.gmane.org; Sun, 03 Feb 2008 14:33:15 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JLexj-0005TE-38 for ged-emacs-devel@m.gmane.org; Sun, 03 Feb 2008 08:32:47 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JLexL-00058Z-BE for emacs-devel@gnu.org; Sun, 03 Feb 2008 08:32:23 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JLexK-000580-Kr for emacs-devel@gnu.org; Sun, 03 Feb 2008 08:32:22 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JLexK-00057q-Fx for emacs-devel@gnu.org; Sun, 03 Feb 2008 08:32:22 -0500 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1JLexJ-0008Iq-Ue for emacs-devel@gnu.org; Sun, 03 Feb 2008 08:32:22 -0500 Original-Received: (qmail invoked by alias); 03 Feb 2008 13:32:20 -0000 Original-Received: from p57A2248B.dip0.t-ipconnect.de (EHLO arthur.local) [87.162.36.139] by mail.gmx.net (mp042) with SMTP; 03 Feb 2008 14:32:20 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1/MQGQCkwjM9FwkGgxpkUQU6tNrVIMxqCkoFkYo4X Y5E56lo0DQWpYh In-Reply-To: (Stefan Monnier's message of "Fri, 01 Feb 2008 14:09:34 -0500") User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) 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:88089 Archived-At: Stefan Monnier writes: > Hmm... I see your point and now I'm not so sure about the function > I propose. I always thought that for process-file and > start-file-process, the best option was always to use > file-relative-name, but then the same argument should apply to my > file-local-name. So the main missing feature is to figure out whether > that relative name will work, which depends on whether > unhandled-file-name-directory returns something that works or not. 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. 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. > 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'. > 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. > Stefan Best regards, Michael.