comparison lisp/files.el @ 80662:11132aa5cccf

(abbreviate-file-name): When replacing $HOME with ~, turn off case-fold-search.
author Chong Yidong <cyd@stupidchicken.com>
date Thu, 31 Jul 2008 21:12:21 +0000
parents c67d2b72f70a
children f971d5caa309
comparison
equal deleted inserted replaced
80661:a44f4ed31447 80662:11132aa5cccf
1316 (if (and automount-dir-prefix 1316 (if (and automount-dir-prefix
1317 (string-match automount-dir-prefix filename) 1317 (string-match automount-dir-prefix filename)
1318 (file-exists-p (file-name-directory 1318 (file-exists-p (file-name-directory
1319 (substring filename (1- (match-end 0)))))) 1319 (substring filename (1- (match-end 0))))))
1320 (setq filename (substring filename (1- (match-end 0))))) 1320 (setq filename (substring filename (1- (match-end 0)))))
1321 (let ((tail directory-abbrev-alist)) 1321 ;; Avoid treating /home/foo as /home/Foo during `~' substitution.
1322 ;; To fix this right, we need a `file-name-case-sensitive-p'
1323 ;; function, but we don't have that yet, so just guess.
1324 (let ((case-fold-search
1325 (memq system-type '(ms-dos windows-nt darwin cygwin))))
1322 ;; If any elt of directory-abbrev-alist matches this name, 1326 ;; If any elt of directory-abbrev-alist matches this name,
1323 ;; abbreviate accordingly. 1327 ;; abbreviate accordingly.
1324 (while tail 1328 (dolist (dir-abbrev directory-abbrev-alist)
1325 (if (string-match (car (car tail)) filename) 1329 (if (string-match (car dir-abbrev) filename)
1326 (setq filename 1330 (setq filename
1327 (concat (cdr (car tail)) (substring filename (match-end 0))))) 1331 (concat (cdr dir-abbrev)
1328 (setq tail (cdr tail))) 1332 (substring filename (match-end 0))))))
1329 ;; Compute and save the abbreviated homedir name. 1333 ;; Compute and save the abbreviated homedir name.
1330 ;; We defer computing this until the first time it's needed, to 1334 ;; We defer computing this until the first time it's needed, to
1331 ;; give time for directory-abbrev-alist to be set properly. 1335 ;; give time for directory-abbrev-alist to be set properly.
1332 ;; We include a slash at the end, to avoid spurious matches 1336 ;; We include a slash at the end, to avoid spurious matches
1333 ;; such as `/usr/foobar' when the home dir is `/usr/foo'. 1337 ;; such as `/usr/foobar' when the home dir is `/usr/foo'.