- (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)
+ (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 last 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 (car 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)