diff options
| author | Noam Postavsky | 2018-01-16 16:26:56 -0500 |
|---|---|---|
| committer | Noam Postavsky | 2018-01-18 16:26:52 -0500 |
| commit | 76040d1eae4464b468481231c15e7fb86f4b11d8 (patch) | |
| tree | 29fde1ab4d637a33adabb70d47a536ad178e92ac /lisp | |
| parent | 0c9b05003f40566145aa2070f07c70e70f36e8a0 (diff) | |
| download | emacs-76040d1eae4464b468481231c15e7fb86f4b11d8.tar.gz 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')
| -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." | |||
| 78 | shadows ; List of shadowings, to be returned. | 78 | shadows ; List of shadowings, to be returned. |
| 79 | files ; File names ever seen, with dirs. | 79 | files ; File names ever seen, with dirs. |
| 80 | dir ; The dir being currently scanned. | 80 | dir ; The dir being currently scanned. |
| 81 | dir-case-insensitive ; `file-name-case-insentive-p' for dir. | ||
| 81 | curr-files ; This dir's Emacs Lisp files. | 82 | curr-files ; This dir's Emacs Lisp files. |
| 82 | orig-dir ; Where the file was first seen. | 83 | orig-dir ; Where the file was first seen. |
| 83 | files-seen-this-dir ; Files seen so far in this dir. | 84 | 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." | |||
| 104 | (message "Checking %d files in %s..." (length curr-files) dir)) | 105 | (message "Checking %d files in %s..." (length curr-files) dir)) |
| 105 | 106 | ||
| 106 | (setq files-seen-this-dir nil) | 107 | (setq files-seen-this-dir nil) |
| 108 | ;; We assume that case sensitivity of a directory applies to | ||
| 109 | ;; its files. | ||
| 110 | (setq dir-case-insensitive (file-name-case-insensitive-p dir)) | ||
| 107 | 111 | ||
| 108 | (dolist (file curr-files) | 112 | (dolist (file curr-files) |
| 109 | 113 | ||
| @@ -123,10 +127,12 @@ See the documentation for `list-load-path-shadows' for further information." | |||
| 123 | ;; XXX.elc (or vice-versa) when they are in the same directory. | 127 | ;; XXX.elc (or vice-versa) when they are in the same directory. |
| 124 | (setq files-seen-this-dir (cons file files-seen-this-dir)) | 128 | (setq files-seen-this-dir (cons file files-seen-this-dir)) |
| 125 | 129 | ||
| 126 | (if (setq orig-dir (assoc file files)) | 130 | (if (setq orig-dir (assoc file files |
| 131 | (when dir-case-insensitive | ||
| 132 | (lambda (f1 f2) (eq (compare-strings f1 nil nil f2 nil nil t) t))))) | ||
| 127 | ;; This file was seen before, we have a shadowing. | 133 | ;; This file was seen before, we have a shadowing. |
| 128 | ;; Report it unless the files are identical. | 134 | ;; Report it unless the files are identical. |
| 129 | (let ((base1 (concat (cdr orig-dir) "/" file)) | 135 | (let ((base1 (concat (cdr orig-dir) "/" (car orig-dir))) |
| 130 | (base2 (concat dir "/" file))) | 136 | (base2 (concat dir "/" file))) |
| 131 | (if (not (and load-path-shadows-compare-text | 137 | (if (not (and load-path-shadows-compare-text |
| 132 | (load-path-shadows-same-file-or-nonexistent | 138 | (load-path-shadows-same-file-or-nonexistent |