From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Emacs Defect. file-relative-name fail on some MS Windows Styled Path Date: Sat, 30 Jun 2012 20:36:04 +0300 Message-ID: <83395c7ldn.fsf@gnu.org> References: <56cbed23-5da2-4173-a5e2-706a1e63b3f4@oo8g2000pbc.googlegroups.com> <834nps7m2e.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org X-Trace: dough.gmane.org 1341077785 7335 80.91.229.3 (30 Jun 2012 17:36:25 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 30 Jun 2012 17:36:25 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jun 30 19:36:25 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Sl1aq-0001RD-S5 for geh-help-gnu-emacs@m.gmane.org; Sat, 30 Jun 2012 19:36:25 +0200 Original-Received: from localhost ([::1]:46245 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sl1aq-0003K4-Hp for geh-help-gnu-emacs@m.gmane.org; Sat, 30 Jun 2012 13:36:24 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sl1al-0003Jv-06 for help-gnu-emacs@gnu.org; Sat, 30 Jun 2012 13:36:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sl1aj-0002E0-3G for help-gnu-emacs@gnu.org; Sat, 30 Jun 2012 13:36:18 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:34254) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sl1ai-0002Du-Re for help-gnu-emacs@gnu.org; Sat, 30 Jun 2012 13:36:17 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0M6F00F00Y7LCQ00@a-mtaout20.012.net.il> for help-gnu-emacs@gnu.org; Sat, 30 Jun 2012 20:36:14 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.210.75]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M6F00F7UY8D2I60@a-mtaout20.012.net.il> for help-gnu-emacs@gnu.org; Sat, 30 Jun 2012 20:36:14 +0300 (IDT) In-reply-to: <834nps7m2e.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 80.179.55.166 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:85588 Archived-At: > Date: Sat, 30 Jun 2012 20:21:13 +0300 > From: Eli Zaretskii > > > From: Xah Lee > > Date: Sat, 30 Jun 2012 09:42:52 -0700 (PDT) > > > > Emacs Defect. file-relative-name fail on some MS Windows Styled Path > > > > file-relative-name doesn't work on MS Windows style path when the > > drive letter is capitalized. > > Confirmed. Please "M-x report-emacs-bug RET". If you can rebuild your own Emacs, here's a tentative patch: === modified file 'lisp/files.el' --- lisp/files.el 2012-05-07 04:29:59 +0000 +++ lisp/files.el 2012-06-30 17:31:57 +0000 @@ -4310,7 +4310,8 @@ on a DOS/Windows machine, it returns FIL default-directory)))) (setq filename (expand-file-name filename)) (let ((fremote (file-remote-p filename)) - (dremote (file-remote-p directory))) + (dremote (file-remote-p directory)) + (fold-case read-file-name-completion-ignore-case)) (if ;; Conditions for separate trees (or ;; Test for different filesystems on DOS/Windows @@ -4319,7 +4320,7 @@ on a DOS/Windows machine, it returns FIL (memq system-type '(ms-dos cygwin windows-nt)) (or ;; Test for different drive letters - (not (eq t (compare-strings filename 0 2 directory 0 2))) + (not (eq t (compare-strings filename 0 2 directory 0 2 fold-case))) ;; Test for UNCs on different servers (not (eq t (compare-strings (progn @@ -4344,16 +4345,16 @@ on a DOS/Windows machine, it returns FIL (while (not (or (eq t (compare-strings filename-dir nil (length directory) - directory nil nil case-fold-search)) + directory nil nil fold-case)) (eq t (compare-strings filename nil (length directory) - directory nil nil case-fold-search)))) + directory nil nil fold-case)))) (setq directory (file-name-directory (substring directory 0 -1)) ancestor (if (equal ancestor ".") ".." (concat "../" ancestor)))) ;; Now ancestor is empty, or .., or ../.., etc. (if (eq t (compare-strings filename nil (length directory) - directory nil nil case-fold-search)) + directory nil nil fold-case)) ;; We matched within FILENAME's directory part. ;; Add the rest of FILENAME onto ANCESTOR. (let ((rest (substring filename (length directory))))