all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Emacs Defect. file-relative-name fail on some MS Windows Styled Path
Date: Sat, 30 Jun 2012 20:36:04 +0300	[thread overview]
Message-ID: <83395c7ldn.fsf@gnu.org> (raw)
In-Reply-To: <834nps7m2e.fsf@gnu.org>

> Date: Sat, 30 Jun 2012 20:21:13 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > From: Xah Lee <xahlee@gmail.com>
> > 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))))




  reply	other threads:[~2012-06-30 17:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-30 16:42 Emacs Defect. file-relative-name fail on some MS Windows Styled Path Xah Lee
2012-06-30 17:21 ` Eli Zaretskii
2012-06-30 17:36   ` Eli Zaretskii [this message]
     [not found]   ` <mailman.3770.1341077781.855.help-gnu-emacs@gnu.org>
2012-06-30 18:52     ` Xah Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83395c7ldn.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.