From: Eli Zaretskii Date: Sun, 1 Jul 2012 16:38:53 +0000 (+0300) Subject: Fix bug #11827 with file-relative-name on MS-Windows. X-Git-Tag: emacs-24.2~58 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=93842198fc2b3c3bb678588372034bbaa09a768b;p=emacs.git Fix bug #11827 with file-relative-name on MS-Windows. lisp/files.el (file-relative-name): Compare file names case-insensitively if on MS-Windows or MS-DOS, or if read-file-name-completion-ignore-case is non-nil. Don't use case-fold-search for this purpose. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9373bf14fbb..74914cd973c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2012-07-01 Eli Zaretskii + + * files.el (file-relative-name): Compare file names + case-insensitively if on MS-Windows or MS-DOS, or if + read-file-name-completion-ignore-case is non-nil. Don't use + case-fold-search for this purpose. (Bug#11827) + 2012-06-28 Andreas Schwab * calendar/cal-dst.el (calendar-current-time-zone): Return diff --git a/lisp/files.el b/lisp/files.el index c46d7c22d92..cf9521731e2 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4310,7 +4310,9 @@ on a DOS/Windows machine, it returns FILENAME in expanded form." 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 (or (memq system-type '(ms-dos cygwin windows-nt)) + read-file-name-completion-ignore-case))) (if ;; Conditions for separate trees (or ;; Test for different filesystems on DOS/Windows @@ -4319,7 +4321,7 @@ on a DOS/Windows machine, it returns FILENAME in expanded form." (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 +4346,16 @@ on a DOS/Windows machine, it returns FILENAME in expanded form." (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))))