Mercurial > emacs
comparison lisp/emacs-lisp/shadow.el @ 110924:a134abd52088
Rename another shadow.el function.
* lisp/emacs-lisp/shadow.el (find-emacs-lisp-shadows): Rename it...
(load-path-shadows-find): ... to this.
(list-load-path-shadows): Update for above change.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Fri, 08 Oct 2010 17:44:53 -0700 |
parents | 3466369fdfcd |
children | 2316b868d5be 376148b31b5e |
comparison
equal
deleted
inserted
replaced
110923:9246a8f688c5 | 110924:a134abd52088 |
---|---|
22 ;; You should have received a copy of the GNU General Public License | 22 ;; You should have received a copy of the GNU General Public License |
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | 23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
24 | 24 |
25 ;;; Commentary: | 25 ;;; Commentary: |
26 | 26 |
27 ;; The functions in this file detect (`find-emacs-lisp-shadows') | 27 ;; The functions in this file detect (`load-path-shadows-find') |
28 ;; and display (`list-load-path-shadows') potential load-path | 28 ;; and display (`list-load-path-shadows') potential load-path |
29 ;; problems that arise when Emacs Lisp files "shadow" each other. | 29 ;; problems that arise when Emacs Lisp files "shadow" each other. |
30 ;; | 30 ;; |
31 ;; For example, a file XXX.el early in one's load-path will shadow | 31 ;; For example, a file XXX.el early in one's load-path will shadow |
32 ;; a file with the same name in a later load-path directory. When | 32 ;; a file with the same name in a later load-path directory. When |
63 "If non-nil, then shadowing files are reported only if their text differs. | 63 "If non-nil, then shadowing files are reported only if their text differs. |
64 This is slower, but filters out some innocuous shadowing." | 64 This is slower, but filters out some innocuous shadowing." |
65 :type 'boolean | 65 :type 'boolean |
66 :group 'lisp-shadow) | 66 :group 'lisp-shadow) |
67 | 67 |
68 (defun find-emacs-lisp-shadows (&optional path) | 68 (defun load-path-shadows-find (&optional path) |
69 "Return a list of Emacs Lisp files that create shadows. | 69 "Return a list of Emacs Lisp files that create shadows. |
70 This function does the work for `list-load-path-shadows'. | 70 This function does the work for `list-load-path-shadows'. |
71 | 71 |
72 We traverse PATH looking for shadows, and return a \(possibly empty\) | 72 We traverse PATH looking for shadows, and return a \(possibly empty\) |
73 even-length list of files. A file in this list at position 2i shadows | 73 even-length list of files. A file in this list at position 2i shadows |
139 ;; Not seen before, add it to the list of seen files. | 139 ;; Not seen before, add it to the list of seen files. |
140 (setq files (cons (cons file dir) files))))))) | 140 (setq files (cons (cons file dir) files))))))) |
141 ;; Return the list of shadowings. | 141 ;; Return the list of shadowings. |
142 shadows)) | 142 shadows)) |
143 | 143 |
144 (define-obsolete-function-alias 'find-emacs-lisp-shadows | |
145 'load-path-shadows-find "23.3") | |
146 | |
144 ;; Return true if neither file exists, or if both exist and have identical | 147 ;; Return true if neither file exists, or if both exist and have identical |
145 ;; contents. | 148 ;; contents. |
146 (defun load-path-shadows-same-file-or-nonexistent (f1 f2) | 149 (defun load-path-shadows-same-file-or-nonexistent (f1 f2) |
147 (let ((exists1 (file-exists-p f1)) | 150 (let ((exists1 (file-exists-p f1)) |
148 (exists2 (file-exists-p f2))) | 151 (exists2 (file-exists-p f2))) |
194 \(or vice-versa\), these suffixes are essentially ignored. A file | 197 \(or vice-versa\), these suffixes are essentially ignored. A file |
195 XXX.elc in an early directory \(that does not contain XXX.el\) is | 198 XXX.elc in an early directory \(that does not contain XXX.el\) is |
196 considered to shadow a later file XXX.el, and vice-versa. | 199 considered to shadow a later file XXX.el, and vice-versa. |
197 | 200 |
198 Shadowings are located by calling the (non-interactive) companion | 201 Shadowings are located by calling the (non-interactive) companion |
199 function, `find-emacs-lisp-shadows'." | 202 function, `load-path-shadows-find'." |
200 (interactive) | 203 (interactive) |
201 (let* ((path (copy-sequence load-path)) | 204 (let* ((path (copy-sequence load-path)) |
202 (tem path) | 205 (tem path) |
203 toplevs) | 206 toplevs) |
204 ;; If we can find simple.el in two places, | 207 ;; If we can find simple.el in two places, |
218 (progn | 221 (progn |
219 (setcdr tem nil) | 222 (setcdr tem nil) |
220 (setq tem nil))) | 223 (setq tem nil))) |
221 (setq tem (cdr tem))))) | 224 (setq tem (cdr tem))))) |
222 | 225 |
223 (let* ((shadows (find-emacs-lisp-shadows path)) | 226 (let* ((shadows (load-path-shadows-find path)) |
224 (n (/ (length shadows) 2)) | 227 (n (/ (length shadows) 2)) |
225 (msg (format "%s Emacs Lisp load-path shadowing%s found" | 228 (msg (format "%s Emacs Lisp load-path shadowing%s found" |
226 (if (zerop n) "No" (concat "\n" (number-to-string n))) | 229 (if (zerop n) "No" (concat "\n" (number-to-string n))) |
227 (if (= n 1) " was" "s were")))) | 230 (if (= n 1) " was" "s were")))) |
228 (with-temp-buffer | 231 (with-temp-buffer |