From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: kai.grossjohann@uni-duisburg.de (Kai =?iso-8859-1?q?Gro=DFjohann?=) Newsgroups: gmane.emacs.devel Subject: Re: file-relative-name and remote files Date: Sun, 23 Feb 2003 12:03:39 +0100 Organization: University of Duisburg, Germany Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <84n0kn8dis.fsf@lucy.is.informatik.uni-duisburg.de> References: <3E58A44B.3090306@math.ku.dk> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1045998427 5736 80.91.224.249 (23 Feb 2003 11:07:07 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 23 Feb 2003 11:07:07 +0000 (UTC) Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18mtyL-0001UO-00 for ; Sun, 23 Feb 2003 12:07:05 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18muDH-0007DV-00 for ; Sun, 23 Feb 2003 12:22:32 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18mtxI-0006ut-02 for emacs-devel@quimby.gnus.org; Sun, 23 Feb 2003 06:06:00 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18mtwQ-0006WY-00 for emacs-devel@gnu.org; Sun, 23 Feb 2003 06:05:06 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18mtwK-0006Ts-00 for emacs-devel@gnu.org; Sun, 23 Feb 2003 06:05:01 -0500 Original-Received: from main.gmane.org ([80.91.224.249]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18mtw1-00067x-00 for emacs-devel@gnu.org; Sun, 23 Feb 2003 06:04:41 -0500 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 18mtvn-0001P4-00 for ; Sun, 23 Feb 2003 12:04:27 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 18mtvm-0001Oo-00 for ; Sun, 23 Feb 2003 12:04:26 +0100 Original-Lines: 32 Original-X-Complaints-To: usenet@main.gmane.org User-Agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.3.50 Cancel-Lock: sha1:H4Df/faeDXto71D+EnKqvb282Ac= X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:11873 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:11873 Lars Hansen writes: > file-relative-name assumes that filename and directory is part of the > same tree except when we are on a DOS/Windows system and the first two > chars in the expanded file names (the drive) are not equal. This > approach does not work with remote files. With remote files filename > and directory may reside in different trees. Since the syntax of > remote files just is a prefix to an ordinary file name, it should be a > matter of comparing prefixes, just as in the DOS/Windows > case. However, remote files are handled by the file name handler > mechanism which does not work for file-relative-name, since > file-relative-name is a lisp function. > > What would be the best way to solve this problem? Whee. Good spotting. IMHO, the following might work: file-relative-name finds a filename handler for the filename and one for the directory. If they are different, then the two must come from different handlers, so do like the different-drives case. If they are equal, invoke the handler. This requires a new file operation, file-relative-name. It seems to work for Ange-FTP and Tramp. However... Imagine that there was a filename handler which could look inside of tar files, so that the filename /tmp/foo.tar/x/y would extract the file x/y from the tarball /tmp/foo.tar. So should (file-relative-name "/tmp/foo.tar/x/y" "/tmp") eval to "foo.tar/x/y" or not? -- A preposition is not a good thing to end a sentence with.