diff options
author | Noam Postavsky <npostavs@gmail.com> | 2018-01-16 16:26:56 -0500 |
---|---|---|
committer | Noam Postavsky <npostavs@gmail.com> | 2018-01-18 16:26:52 -0500 |
commit | 76040d1eae4464b468481231c15e7fb86f4b11d8 (patch) | |
tree | 29fde1ab4d637a33adabb70d47a536ad178e92ac /lisp/emacs-lisp | |
parent | 0c9b05003f40566145aa2070f07c70e70f36e8a0 (diff) | |
download | emacs-76040d1eae4464b468481231c15e7fb86f4b11d8.tar.gz emacs-76040d1eae4464b468481231c15e7fb86f4b11d8.tar.bz2 emacs-76040d1eae4464b468481231c15e7fb86f4b11d8.zip |
Handle case-insensitive filenames for load-path shadows (Bug#5845)
* lisp/emacs-lisp/shadow.el (load-path-shadows-find): Check for
shadowing with case-insensitive matching for files of case-insensitive
directories (as determined by `file-name-case-insensitive-p').
* test/lisp/emacs-lisp/shadow-tests.el: New test.
* test/lisp/emacs-lisp/shadow-resources/p1/foo.el:
* test/lisp/emacs-lisp/shadow-resources/p2/FOO.el: New test files.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/shadow.el | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/shadow.el b/lisp/emacs-lisp/shadow.el index 88a494fdd40..1788f0d71f7 100644 --- a/lisp/emacs-lisp/shadow.el +++ b/lisp/emacs-lisp/shadow.el @@ -78,6 +78,7 @@ See the documentation for `list-load-path-shadows' for further information." shadows ; List of shadowings, to be returned. files ; File names ever seen, with dirs. dir ; The dir being currently scanned. + dir-case-insensitive ; `file-name-case-insentive-p' for dir. curr-files ; This dir's Emacs Lisp files. orig-dir ; Where the file was first seen. files-seen-this-dir ; Files seen so far in this dir. @@ -104,6 +105,9 @@ See the documentation for `list-load-path-shadows' for further information." (message "Checking %d files in %s..." (length curr-files) dir)) (setq files-seen-this-dir nil) + ;; We assume that case sensitivity of a directory applies to + ;; its files. + (setq dir-case-insensitive (file-name-case-insensitive-p dir)) (dolist (file curr-files) @@ -123,10 +127,12 @@ See the documentation for `list-load-path-shadows' for further information." ;; XXX.elc (or vice-versa) when they are in the same directory. (setq files-seen-this-dir (cons file files-seen-this-dir)) - (if (setq orig-dir (assoc file files)) + (if (setq orig-dir (assoc file files + (when dir-case-insensitive + (lambda (f1 f2) (eq (compare-strings f1 nil nil f2 nil nil t) t))))) ;; This file was seen before, we have a shadowing. ;; Report it unless the files are identical. - (let ((base1 (concat (cdr orig-dir) "/" file)) + (let ((base1 (concat (cdr orig-dir) "/" (car orig-dir))) (base2 (concat dir "/" file))) (if (not (and load-path-shadows-compare-text (load-path-shadows-same-file-or-nonexistent |