Mercurial > emacs
comparison lisp/emacs-lisp/shadow.el @ 19313:04175c55c49b
(list-load-path-shadows): Exclude, from the path we search, all but
the first set of directories that include the standard Emacs Lisp files.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 12 Aug 1997 05:30:47 +0000 |
parents | c160218de690 |
children | 199256234202 |
comparison
equal
deleted
inserted
replaced
19312:d67c0dba233d | 19313:04175c55c49b |
---|---|
171 When run interactively, the shadowings \(if any\) are displayed in a | 171 When run interactively, the shadowings \(if any\) are displayed in a |
172 buffer called `*Shadows*'. Shadowings are located by calling the | 172 buffer called `*Shadows*'. Shadowings are located by calling the |
173 \(non-interactive\) companion function, `find-emacs-lisp-shadows'." | 173 \(non-interactive\) companion function, `find-emacs-lisp-shadows'." |
174 | 174 |
175 (interactive) | 175 (interactive) |
176 (let* ((shadows (find-emacs-lisp-shadows)) | 176 (let* ((path (copy-sequence load-path)) |
177 (n (/ (length shadows) 2)) | 177 (tem path) |
178 (msg (format "%s Emacs Lisp load-path shadowing%s found" | 178 toplevs) |
179 (if (zerop n) "No" (concat "\n" (number-to-string n))) | 179 ;; If we can find simple.el in two places, |
180 (if (= n 1) " was" "s were")))) | 180 (while tem |
181 (if (interactive-p) | 181 (if (file-exists-p (expand-file-name "simple.el" (car tem))) |
182 (save-excursion | 182 (setq toplevs (cons (car tem) toplevs))) |
183 ;; We are interactive. | 183 (setq tem (cdr tem))) |
184 ;; Create the *Shadows* buffer and display shadowings there. | 184 (if (> (length toplevs) 1) |
185 (let ((output-buffer (get-buffer-create "*Shadows*"))) | 185 ;; Cut off our copy of load-path right before |
186 (display-buffer output-buffer) | 186 ;; the second directory which has simple.el in it. |
187 (set-buffer output-buffer) | 187 ;; This avoids loads of duplications between the source dir |
188 (erase-buffer) | 188 ;; and the dir where these files were copied by installation. |
189 (while shadows | 189 (let ((break (nth (- (length toplevs) 2) toplevs))) |
190 (insert (format "%s hides %s\n" (car shadows) | 190 (setq tem path) |
191 (car (cdr shadows)))) | 191 (while tem |
192 (setq shadows (cdr (cdr shadows)))) | 192 (if (eq (nth 1 tem) break) |
193 (insert msg "\n"))) | 193 (progn |
194 ;; We are non-interactive, print shadows via message. | 194 (setcdr tem nil) |
195 (when shadows | 195 (setq tem nil))) |
196 (message "This site has duplicate Lisp libraries with the same name. | 196 (setq tem (cdr tem))))) |
197 | |
198 (let* ((shadows (find-emacs-lisp-shadows path)) | |
199 (n (/ (length shadows) 2)) | |
200 (msg (format "%s Emacs Lisp load-path shadowing%s found" | |
201 (if (zerop n) "No" (concat "\n" (number-to-string n))) | |
202 (if (= n 1) " was" "s were")))) | |
203 (if (interactive-p) | |
204 (save-excursion | |
205 ;; We are interactive. | |
206 ;; Create the *Shadows* buffer and display shadowings there. | |
207 (let ((output-buffer (get-buffer-create "*Shadows*"))) | |
208 (display-buffer output-buffer) | |
209 (set-buffer output-buffer) | |
210 (erase-buffer) | |
211 (while shadows | |
212 (insert (format "%s hides %s\n" (car shadows) | |
213 (car (cdr shadows)))) | |
214 (setq shadows (cdr (cdr shadows)))) | |
215 (insert msg "\n"))) | |
216 ;; We are non-interactive, print shadows via message. | |
217 (when shadows | |
218 (message "This site has duplicate Lisp libraries with the same name. | |
197 If a locally-installed Lisp library overrides a library in the Emacs release, | 219 If a locally-installed Lisp library overrides a library in the Emacs release, |
198 that can cause trouble, and you should probably remove the locally-installed | 220 that can cause trouble, and you should probably remove the locally-installed |
199 version unless you know what you are doing.\n")) | 221 version unless you know what you are doing.\n")) |
200 (while shadows | 222 (while shadows |
201 (message "%s hides %s" (car shadows) (car (cdr shadows))) | 223 (message "%s hides %s" (car shadows) (car (cdr shadows))) |
202 (setq shadows (cdr (cdr shadows)))) | 224 (setq shadows (cdr (cdr shadows)))) |
203 (message "%s" msg)))) | 225 (message "%s" msg))))) |
204 | 226 |
205 (provide 'shadow) | 227 (provide 'shadow) |
206 | 228 |
207 ;;; shadow.el ends here | 229 ;;; shadow.el ends here |