53 |
|
|
54 |
;;; Code: |
;;; Code: |
55 |
|
|
56 |
(defgroup shadow nil |
(defgroup lisp-shadow nil |
57 |
"Locate Emacs Lisp file shadowings." |
"Locate Emacs Lisp file shadowings." |
58 |
:prefix "shadows-" |
:prefix "shadows-" |
59 |
:group 'lisp) |
:group 'lisp) |
62 |
"*If non-nil, then shadowing files are reported only if their text differs. |
"*If non-nil, then shadowing files are reported only if their text differs. |
63 |
This is slower, but filters out some innocuous shadowing." |
This is slower, but filters out some innocuous shadowing." |
64 |
:type 'boolean |
:type 'boolean |
65 |
:group 'shadow) |
:group 'lisp-shadow) |
66 |
|
|
67 |
(defun find-emacs-lisp-shadows (&optional path) |
(defun find-emacs-lisp-shadows (&optional path) |
68 |
"Return a list of Emacs Lisp files that create shadows. |
"Return a list of Emacs Lisp files that create shadows. |
74 |
are stripped from the file names in the list. |
are stripped from the file names in the list. |
75 |
|
|
76 |
See the documentation for `list-load-path-shadows' for further information." |
See the documentation for `list-load-path-shadows' for further information." |
77 |
|
|
78 |
(or path (setq path load-path)) |
(or path (setq path load-path)) |
79 |
|
|
80 |
(let (true-names ; List of dirs considered. |
(let (true-names ; List of dirs considered. |
86 |
files-seen-this-dir ; Files seen so far in this dir. |
files-seen-this-dir ; Files seen so far in this dir. |
87 |
file) ; The current file. |
file) ; The current file. |
88 |
|
|
89 |
|
|
90 |
(while path |
(while path |
91 |
|
|
92 |
(setq dir (directory-file-name (file-truename (or (car path) ".")))) |
(setq dir (directory-file-name (file-truename (or (car path) ".")))) |
125 |
;; This test prevents us declaring that XXX.el shadows |
;; This test prevents us declaring that XXX.el shadows |
126 |
;; XXX.elc (or vice-versa) when they are in the same directory. |
;; XXX.elc (or vice-versa) when they are in the same directory. |
127 |
(setq files-seen-this-dir (cons file files-seen-this-dir)) |
(setq files-seen-this-dir (cons file files-seen-this-dir)) |
128 |
|
|
129 |
(if (setq orig-dir (assoc file files)) |
(if (setq orig-dir (assoc file files)) |
130 |
;; This file was seen before, we have a shadowing. |
;; This file was seen before, we have a shadowing. |
131 |
;; Report it unless the files are identical. |
;; Report it unless the files are identical. |
202 |
When run interactively, the shadowings \(if any\) are displayed in a |
When run interactively, the shadowings \(if any\) are displayed in a |
203 |
buffer called `*Shadows*'. Shadowings are located by calling the |
buffer called `*Shadows*'. Shadowings are located by calling the |
204 |
\(non-interactive\) companion function, `find-emacs-lisp-shadows'." |
\(non-interactive\) companion function, `find-emacs-lisp-shadows'." |
205 |
|
|
206 |
(interactive) |
(interactive) |
207 |
(let* ((path (copy-sequence load-path)) |
(let* ((path (copy-sequence load-path)) |
208 |
(tem path) |
(tem path) |