From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Lars Hansen Newsgroups: gmane.emacs.devel Subject: Patch to file-relative-name Date: Mon, 31 Mar 2003 00:12:08 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <3E876BB8.4060009@math.ku.dk> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1049062905 685 80.91.224.249 (30 Mar 2003 22:21:45 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 30 Mar 2003 22:21:45 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Mar 31 00:21:44 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18zlBP-0000Au-00 for ; Mon, 31 Mar 2003 00:21:43 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18zlEw-0004Wx-00 for ; Mon, 31 Mar 2003 00:25:22 +0200 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 18zlAf-0001IN-06 for emacs-devel@quimby.gnus.org; Sun, 30 Mar 2003 17:20:57 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18zl4Z-0007Lm-00 for emacs-devel@gnu.org; Sun, 30 Mar 2003 17:14:39 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18zl2r-0006RT-00 for emacs-devel@gnu.org; Sun, 30 Mar 2003 17:12:56 -0500 Original-Received: from [62.84.220.10] (helo=post.kabelnettet.dk) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18zl18-0005aR-00 for emacs-devel@gnu.org; Sun, 30 Mar 2003 17:11:06 -0500 Original-Received: from math.ku.dk [62.84.220.219] by post.kabelnettet.dk with ESMTP (SMTPD32-7.14) id AC4114E6012C; Mon, 31 Mar 2003 00:14:25 +0200 User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en Original-To: emacs-devel@gnu.org 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:12753 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:12753 After the separate-trees parameter has been removed from my version of file-relative-name, there is a superfluous "and". This is removed in the patch below. Furthermore, the docstring is made a little more precise. D:\cvs\emacs\lisp>diff -c files.el new-files.el diff -c files.el new-files.el *** files.el Sun Mar 30 23:58:18 2003 --- new-files.el Mon Mar 31 00:00:56 2003 *************** *** 2826,2832 **** This function returns a relative file name which is equivalent to FILENAME when used with that default directory as the default. If FILENAME and DIRECTORY lie on different machines or on different drives ! \(DOS/Windows), it returns FILENAME in expanded form." (save-match-data (setq directory (file-name-as-directory (expand-file-name (or directory --- 2826,2832 ---- This function returns a relative file name which is equivalent to FILENAME when used with that default directory as the default. If FILENAME and DIRECTORY lie on different machines or on different drives ! on a DOS/Windows machine, it returns FILENAME on expanded form." (save-match-data (setq directory (file-name-as-directory (expand-file-name (or directory *************** *** 2836,2843 **** (hd (find-file-name-handler directory 'file-local-copy))) (when (and hf (not (get hf 'file-remote-p))) (setq hf nil)) (when (and hd (not (get hd 'file-remote-p))) (setq hd nil)) ! (if (and ! ;; Conditions for separate trees (or ;; Test for different drives on DOS/Windows (and --- 2836,2842 ---- (hd (find-file-name-handler directory 'file-local-copy))) (when (and hf (not (get hf 'file-remote-p))) (setq hf nil)) (when (and hd (not (get hd 'file-remote-p))) (setq hd nil)) ! (if ;; Conditions for separate trees (or ;; Test for different drives on DOS/Windows (and *************** *** 2857,2863 **** (substring filename 0 (match-end 0))) (and (string-match re directory) ! (substring directory 0 (match-end 0))))))))) filename (unless (eq (aref filename 0) ?/) (setq filename (concat "/" filename))) --- 2856,2862 ---- (substring filename 0 (match-end 0))) (and (string-match re directory) ! (substring directory 0 (match-end 0)))))))) filename (unless (eq (aref filename 0) ?/) (setq filename (concat "/" filename)))