comparison lisp/minibuf.el @ 4720:3c92890f3750

Add `file-system-ignore-case-p', use it. 2009-10-24 Aidan Kehoe <kehoea@parhasard.net> * files.el (default-file-system-ignore-case): New variable. (file-system-case-alist): New variable. (file-system-ignore-case-p): New function; return t if file names under PATH should be treated case-insensitively. * minibuf.el (read-file-name-1, read-file-name-internal-1) (read-file-name-internal-1): * package-admin.el (package-admin-check-manifest): Use file-system-ignore-case-p instead of checking system-type directly in these functions. (Even though minibuf.el is dumped before files.el, the function is only called in interactive usage, there's no dump time order dependency here.)
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 24 Oct 2009 15:33:23 +0100
parents 9a1a59b4b75d
children 74a5eaa67982
comparison
equal deleted inserted replaced
4719:bd51ab22afa8 4720:3c92890f3750
1696 initial-contents completer) 1696 initial-contents completer)
1697 )) 1697 ))
1698 (add-one-shot-hook 1698 (add-one-shot-hook
1699 'minibuffer-setup-hook 1699 'minibuffer-setup-hook
1700 (lambda () 1700 (lambda ()
1701 ;; #### SCREAM! Create a `file-system-ignore-case' 1701 (and (file-system-ignore-case-p (or dir default-directory))
1702 ;; function, so this kind of stuff is generalized!
1703 (and (eq system-type 'windows-nt)
1704 (set (make-local-variable 'completion-ignore-case) t)) 1702 (set (make-local-variable 'completion-ignore-case) t))
1705 (set 1703 (set
1706 (make-local-variable 1704 (make-local-variable
1707 'completion-display-completion-list-function) 1705 'completion-display-completion-list-function)
1708 #'(lambda (completions) 1706 #'(lambda (completions)
1775 (if (not (string-match 1773 (if (not (string-match
1776 "\\([^$]\\|\\`\\)\\(\\$\\$\\)*\\$\\([A-Za-z0-9_]*\\|{[^}]*\\)\\'" 1774 "\\([^$]\\|\\`\\)\\(\\$\\$\\)*\\$\\([A-Za-z0-9_]*\\|{[^}]*\\)\\'"
1777 string)) 1775 string))
1778 ;; Not doing environment-variable completion hack 1776 ;; Not doing environment-variable completion hack
1779 (let* ((orig (if (equal string "") nil string)) 1777 (let* ((orig (if (equal string "") nil string))
1778 (completion-ignore-case (file-system-ignore-case-p
1779 (or dir default-directory)))
1780 (sstring (if orig (substitute-in-file-name string) string)) 1780 (sstring (if orig (substitute-in-file-name string) string))
1781 (specdir (if orig (file-name-directory sstring) nil)) 1781 (specdir (if orig (file-name-directory sstring) nil))
1782 (name (if orig (file-name-nondirectory sstring) string)) 1782 (name (if orig (file-name-nondirectory sstring) string))
1783 (direct (if specdir (expand-file-name specdir dir) dir))) 1783 (direct (if specdir (expand-file-name specdir dir) dir)))
1784 ;; ~username completion 1784 ;; ~username completion
1812 specdir 1812 specdir
1813 direct 1813 direct
1814 name))) 1814 name)))
1815 ;; An odd number of trailing $'s 1815 ;; An odd number of trailing $'s
1816 (let* ((start (match-beginning 3)) 1816 (let* ((start (match-beginning 3))
1817 (completion-ignore-case (file-system-ignore-case-p
1818 (or dir default-directory)))
1817 (env (substring string 1819 (env (substring string
1818 (cond ((= start (length string)) 1820 (cond ((= start (length string))
1819 ;; "...$" 1821 ;; "...$"
1820 start) 1822 start)
1821 ((= (aref string start) ?{) 1823 ((= (aref string start) ?{)