# HG changeset patch # User Richard M. Stallman # Date 871363847 0 # Node ID 04175c55c49b9a5bafaf09dd45e44a24bc1788ed # Parent d67c0dba233dc8820c215f70a8a86ccce36fd32d (list-load-path-shadows): Exclude, from the path we search, all but the first set of directories that include the standard Emacs Lisp files. diff -r d67c0dba233d -r 04175c55c49b lisp/emacs-lisp/shadow.el --- a/lisp/emacs-lisp/shadow.el Tue Aug 12 00:58:44 1997 +0000 +++ b/lisp/emacs-lisp/shadow.el Tue Aug 12 05:30:47 1997 +0000 @@ -173,34 +173,56 @@ \(non-interactive\) companion function, `find-emacs-lisp-shadows'." (interactive) - (let* ((shadows (find-emacs-lisp-shadows)) - (n (/ (length shadows) 2)) - (msg (format "%s Emacs Lisp load-path shadowing%s found" - (if (zerop n) "No" (concat "\n" (number-to-string n))) - (if (= n 1) " was" "s were")))) - (if (interactive-p) - (save-excursion - ;; We are interactive. - ;; Create the *Shadows* buffer and display shadowings there. - (let ((output-buffer (get-buffer-create "*Shadows*"))) - (display-buffer output-buffer) - (set-buffer output-buffer) - (erase-buffer) - (while shadows - (insert (format "%s hides %s\n" (car shadows) - (car (cdr shadows)))) - (setq shadows (cdr (cdr shadows)))) - (insert msg "\n"))) - ;; We are non-interactive, print shadows via message. - (when shadows - (message "This site has duplicate Lisp libraries with the same name. + (let* ((path (copy-sequence load-path)) + (tem path) + toplevs) + ;; If we can find simple.el in two places, + (while tem + (if (file-exists-p (expand-file-name "simple.el" (car tem))) + (setq toplevs (cons (car tem) toplevs))) + (setq tem (cdr tem))) + (if (> (length toplevs) 1) + ;; Cut off our copy of load-path right before + ;; the second directory which has simple.el in it. + ;; This avoids loads of duplications between the source dir + ;; and the dir where these files were copied by installation. + (let ((break (nth (- (length toplevs) 2) toplevs))) + (setq tem path) + (while tem + (if (eq (nth 1 tem) break) + (progn + (setcdr tem nil) + (setq tem nil))) + (setq tem (cdr tem))))) + + (let* ((shadows (find-emacs-lisp-shadows path)) + (n (/ (length shadows) 2)) + (msg (format "%s Emacs Lisp load-path shadowing%s found" + (if (zerop n) "No" (concat "\n" (number-to-string n))) + (if (= n 1) " was" "s were")))) + (if (interactive-p) + (save-excursion + ;; We are interactive. + ;; Create the *Shadows* buffer and display shadowings there. + (let ((output-buffer (get-buffer-create "*Shadows*"))) + (display-buffer output-buffer) + (set-buffer output-buffer) + (erase-buffer) + (while shadows + (insert (format "%s hides %s\n" (car shadows) + (car (cdr shadows)))) + (setq shadows (cdr (cdr shadows)))) + (insert msg "\n"))) + ;; We are non-interactive, print shadows via message. + (when shadows + (message "This site has duplicate Lisp libraries with the same name. If a locally-installed Lisp library overrides a library in the Emacs release, that can cause trouble, and you should probably remove the locally-installed version unless you know what you are doing.\n")) - (while shadows - (message "%s hides %s" (car shadows) (car (cdr shadows))) - (setq shadows (cdr (cdr shadows)))) - (message "%s" msg)))) + (while shadows + (message "%s hides %s" (car shadows) (car (cdr shadows))) + (setq shadows (cdr (cdr shadows)))) + (message "%s" msg))))) (provide 'shadow)