Mercurial > hg > xemacs-beta
comparison lisp/files.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 | 13273cffca2a |
children | e29fcfd8df5f |
comparison
equal
deleted
inserted
replaced
4719:bd51ab22afa8 | 4720:3c92890f3750 |
---|---|
4512 (car arguments) | 4512 (car arguments) |
4513 (apply operation arguments)))) | 4513 (apply operation arguments)))) |
4514 | 4514 |
4515 ;; END SYNC WITH FSF 21.2. | 4515 ;; END SYNC WITH FSF 21.2. |
4516 | 4516 |
4517 ;; XEmacs: | |
4518 (defvar default-file-system-ignore-case (and | |
4519 (memq system-type '(windows-nt | |
4520 cygwin32 | |
4521 darwin)) | |
4522 t) | |
4523 "What `file-system-ignore-case-p' returns by default. | |
4524 This is in the case that nothing in `file-system-case-alist' matches.") | |
4525 | |
4526 ;; Question; do any of the Linuxes mount Windows partitions in a fixed | |
4527 ;; place? | |
4528 (defvar file-system-case-alist nil | |
4529 "Alist to decide where file name case is significant. | |
4530 | |
4531 The format is ((PATTERN . VAL) ...), where PATTERN is a regular expression | |
4532 matching a file name, and VAL is t if corresponding file names are | |
4533 case-insensitive, nil if corresponding file names are case sensitive. Only | |
4534 the first match will be used. | |
4535 | |
4536 This list is used by `file-system-ignore-case-p', itself used in tab | |
4537 completion; see also `default-file-system-ignore-case'.") | |
4538 | |
4539 (defun file-system-ignore-case-p (path) | |
4540 "Return t if PATH resides on a file system with case-insensitive names. | |
4541 Otherwise, return nil. See `file-system-case-alist' and | |
4542 `default-file-system-ignore-case'." | |
4543 (check-argument-type #'stringp path) | |
4544 (if file-system-case-alist | |
4545 (loop | |
4546 for (pattern . val) | |
4547 in file-system-case-alist | |
4548 do (and (string-match pattern path) (return val)) | |
4549 finally (return default-file-system-ignore-case)) | |
4550 default-file-system-ignore-case)) | |
4551 | |
4517 ;;; files.el ends here | 4552 ;;; files.el ends here |