diff options
author | Richard M. Stallman <rms@gnu.org> | 1997-08-12 05:30:47 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1997-08-12 05:30:47 +0000 |
commit | 0cdbb11dee301e1537bcdab1f4ae53f2515db274 (patch) | |
tree | 02d5877e82a39b7c751f50a18f177cf1f13443ed /lisp/emacs-lisp | |
parent | 67f04586c37572504cfe52aed9e0c19ba640767f (diff) | |
download | emacs-0cdbb11dee301e1537bcdab1f4ae53f2515db274.tar.gz emacs-0cdbb11dee301e1537bcdab1f4ae53f2515db274.tar.bz2 emacs-0cdbb11dee301e1537bcdab1f4ae53f2515db274.zip |
(list-load-path-shadows): Exclude, from the path we search, all but
the first set of directories that include the standard Emacs Lisp files.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/shadow.el | 72 |
1 files changed, 47 insertions, 25 deletions
diff --git a/lisp/emacs-lisp/shadow.el b/lisp/emacs-lisp/shadow.el index 7e49c8b6f17..cca8b350731 100644 --- a/lisp/emacs-lisp/shadow.el +++ b/lisp/emacs-lisp/shadow.el @@ -173,34 +173,56 @@ buffer called `*Shadows*'. Shadowings are located by calling the \(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) |