aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2012-07-01 19:38:53 +0300
committerEli Zaretskii2012-07-01 19:38:53 +0300
commit93842198fc2b3c3bb678588372034bbaa09a768b (patch)
treef45a4feb2dda06facccfde8082e9554e0be0c594
parent3812efdc6c3e112e623afe67482ac0af0da3bcee (diff)
downloademacs-93842198fc2b3c3bb678588372034bbaa09a768b.tar.gz
emacs-93842198fc2b3c3bb678588372034bbaa09a768b.zip
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.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/files.el12
2 files changed, 14 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9373bf14fbb..74914cd973c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12012-07-01 Eli Zaretskii <eliz@gnu.org>
2
3 * files.el (file-relative-name): Compare file names
4 case-insensitively if on MS-Windows or MS-DOS, or if
5 read-file-name-completion-ignore-case is non-nil. Don't use
6 case-fold-search for this purpose. (Bug#11827)
7
12012-06-28 Andreas Schwab <schwab@linux-m68k.org> 82012-06-28 Andreas Schwab <schwab@linux-m68k.org>
2 9
3 * calendar/cal-dst.el (calendar-current-time-zone): Return 10 * 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."
4310 default-directory)))) 4310 default-directory))))
4311 (setq filename (expand-file-name filename)) 4311 (setq filename (expand-file-name filename))
4312 (let ((fremote (file-remote-p filename)) 4312 (let ((fremote (file-remote-p filename))
4313 (dremote (file-remote-p directory))) 4313 (dremote (file-remote-p directory))
4314 (fold-case (or (memq system-type '(ms-dos cygwin windows-nt))
4315 read-file-name-completion-ignore-case)))
4314 (if ;; Conditions for separate trees 4316 (if ;; Conditions for separate trees
4315 (or 4317 (or
4316 ;; Test for different filesystems on DOS/Windows 4318 ;; Test for different filesystems on DOS/Windows
@@ -4319,7 +4321,7 @@ on a DOS/Windows machine, it returns FILENAME in expanded form."
4319 (memq system-type '(ms-dos cygwin windows-nt)) 4321 (memq system-type '(ms-dos cygwin windows-nt))
4320 (or 4322 (or
4321 ;; Test for different drive letters 4323 ;; Test for different drive letters
4322 (not (eq t (compare-strings filename 0 2 directory 0 2))) 4324 (not (eq t (compare-strings filename 0 2 directory 0 2 fold-case)))
4323 ;; Test for UNCs on different servers 4325 ;; Test for UNCs on different servers
4324 (not (eq t (compare-strings 4326 (not (eq t (compare-strings
4325 (progn 4327 (progn
@@ -4344,16 +4346,16 @@ on a DOS/Windows machine, it returns FILENAME in expanded form."
4344 (while (not 4346 (while (not
4345 (or 4347 (or
4346 (eq t (compare-strings filename-dir nil (length directory) 4348 (eq t (compare-strings filename-dir nil (length directory)
4347 directory nil nil case-fold-search)) 4349 directory nil nil fold-case))
4348 (eq t (compare-strings filename nil (length directory) 4350 (eq t (compare-strings filename nil (length directory)
4349 directory nil nil case-fold-search)))) 4351 directory nil nil fold-case))))
4350 (setq directory (file-name-directory (substring directory 0 -1)) 4352 (setq directory (file-name-directory (substring directory 0 -1))
4351 ancestor (if (equal ancestor ".") 4353 ancestor (if (equal ancestor ".")
4352 ".." 4354 ".."
4353 (concat "../" ancestor)))) 4355 (concat "../" ancestor))))
4354 ;; Now ancestor is empty, or .., or ../.., etc. 4356 ;; Now ancestor is empty, or .., or ../.., etc.
4355 (if (eq t (compare-strings filename nil (length directory) 4357 (if (eq t (compare-strings filename nil (length directory)
4356 directory nil nil case-fold-search)) 4358 directory nil nil fold-case))
4357 ;; We matched within FILENAME's directory part. 4359 ;; We matched within FILENAME's directory part.
4358 ;; Add the rest of FILENAME onto ANCESTOR. 4360 ;; Add the rest of FILENAME onto ANCESTOR.
4359 (let ((rest (substring filename (length directory)))) 4361 (let ((rest (substring filename (length directory))))