1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-19 18:13:55 +00:00

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.
This commit is contained in:
Eli Zaretskii 2012-07-01 19:38:53 +03:00
parent 3812efdc6c
commit 93842198fc
2 changed files with 14 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2012-07-01 Eli Zaretskii <eliz@gnu.org>
* 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 <schwab@linux-m68k.org>
* calendar/cal-dst.el (calendar-current-time-zone): Return

View File

@ -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))))