1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-23 22:20:24 -08:00

Use the new 'file-name-case-insensitive-p' function

* lisp/international/mule.el (auto-coding-alist-lookup):
* lisp/files.el (file-truename):
(abbreviate-file-name, set-auto-mode, file-relative-name):
* package.el (package-untar-buffer): Use
'file-name-case-insensitive-p' instead of 'system-type' to test
case-insensitivity.
This commit is contained in:
Ken Brown 2016-11-13 22:00:24 -05:00
parent 181bd848eb
commit cbed42838e
3 changed files with 11 additions and 12 deletions

View file

@ -792,7 +792,7 @@ untar into a directory named DIR; otherwise, signal an error."
(tar-mode) (tar-mode)
;; Make sure everything extracts into DIR. ;; Make sure everything extracts into DIR.
(let ((regexp (concat "\\`" (regexp-quote (expand-file-name dir)) "/")) (let ((regexp (concat "\\`" (regexp-quote (expand-file-name dir)) "/"))
(case-fold-search (memq system-type '(windows-nt ms-dos cygwin)))) (case-fold-search (file-name-case-insensitive-p dir)))
(dolist (tar-data tar-parse-info) (dolist (tar-data tar-parse-info)
(let ((name (expand-file-name (tar-header-name tar-data)))) (let ((name (expand-file-name (tar-header-name tar-data))))
(or (string-match regexp name) (or (string-match regexp name)

View file

@ -1212,7 +1212,7 @@ containing it, until no links are left at any level.
(setq dirfile (directory-file-name dir)) (setq dirfile (directory-file-name dir))
;; If these are equal, we have the (or a) root directory. ;; If these are equal, we have the (or a) root directory.
(or (string= dir dirfile) (or (string= dir dirfile)
(and (memq system-type '(windows-nt ms-dos cygwin nacl)) (and (file-name-case-insensitive-p dir)
(eq (compare-strings dir 0 nil dirfile 0 nil t) t)) (eq (compare-strings dir 0 nil dirfile 0 nil t) t))
;; If this is the same dir we last got the truename for, ;; If this is the same dir we last got the truename for,
;; save time--don't recalculate. ;; save time--don't recalculate.
@ -1793,10 +1793,7 @@ home directory is a root directory) and removes automounter prefixes
(substring filename (1- (match-end 0)))))) (substring filename (1- (match-end 0))))))
(setq filename (substring filename (1- (match-end 0))))) (setq filename (substring filename (1- (match-end 0)))))
;; Avoid treating /home/foo as /home/Foo during `~' substitution. ;; Avoid treating /home/foo as /home/Foo during `~' substitution.
;; To fix this right, we need a `file-name-case-sensitive-p' (let ((case-fold-search (file-name-case-insensitive-p filename)))
;; function, but we don't have that yet, so just guess.
(let ((case-fold-search
(memq system-type '(ms-dos windows-nt darwin cygwin))))
;; If any elt of directory-abbrev-alist matches this name, ;; If any elt of directory-abbrev-alist matches this name,
;; abbreviate accordingly. ;; abbreviate accordingly.
(dolist (dir-abbrev directory-abbrev-alist) (dolist (dir-abbrev directory-abbrev-alist)
@ -2898,7 +2895,9 @@ we don't actually set it to the same mode the buffer already has."
(unless done (unless done
(if buffer-file-name (if buffer-file-name
(let ((name buffer-file-name) (let ((name buffer-file-name)
(remote-id (file-remote-p buffer-file-name))) (remote-id (file-remote-p buffer-file-name))
(case-insensitive-p (file-name-case-insensitive-p
buffer-file-name)))
;; Remove backup-suffixes from file name. ;; Remove backup-suffixes from file name.
(setq name (file-name-sans-versions name)) (setq name (file-name-sans-versions name))
;; Remove remote file name identification. ;; Remove remote file name identification.
@ -2908,12 +2907,12 @@ we don't actually set it to the same mode the buffer already has."
(while name (while name
;; Find first matching alist entry. ;; Find first matching alist entry.
(setq mode (setq mode
(if (memq system-type '(windows-nt cygwin)) (if case-insensitive-p
;; System is case-insensitive. ;; Filesystem is case-insensitive.
(let ((case-fold-search t)) (let ((case-fold-search t))
(assoc-default name auto-mode-alist (assoc-default name auto-mode-alist
'string-match)) 'string-match))
;; System is case-sensitive. ;; Filesystem is case-sensitive.
(or (or
;; First match case-sensitively. ;; First match case-sensitively.
(let ((case-fold-search nil)) (let ((case-fold-search nil))
@ -4691,7 +4690,7 @@ on a DOS/Windows machine, it returns FILENAME in expanded form."
(setq filename (expand-file-name filename)) (setq filename (expand-file-name filename))
(let ((fremote (file-remote-p 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)) (fold-case (or (file-name-case-insensitive-p filename)
read-file-name-completion-ignore-case))) read-file-name-completion-ignore-case)))
(if ;; Conditions for separate trees (if ;; Conditions for separate trees
(or (or

View file

@ -1864,7 +1864,7 @@ files.")
(defun auto-coding-alist-lookup (filename) (defun auto-coding-alist-lookup (filename)
"Return the coding system specified by `auto-coding-alist' for FILENAME." "Return the coding system specified by `auto-coding-alist' for FILENAME."
(let ((alist auto-coding-alist) (let ((alist auto-coding-alist)
(case-fold-search (memq system-type '(windows-nt ms-dos cygwin))) (case-fold-search (file-name-case-insensitive-p filename))
coding-system) coding-system)
(while (and alist (not coding-system)) (while (and alist (not coding-system))
(if (string-match (car (car alist)) filename) (if (string-match (car (car alist)) filename)