annotate lisp/emacs-lisp/shadow.el @ 111684:280ee0988e1a

* lisp/shell.el (shell): Use current-buffer by default if it's already a shell mode buffer and its process is dead. Suggested by <jemarch@gnu.org>.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 23 Nov 2010 09:19:54 -0500
parents 2316b868d5be
children 417b1e4d63cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38436
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 22170
diff changeset
1 ;;; shadow.el --- locate Emacs Lisp file shadowings
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2
104021
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
3 ;; Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106223
diff changeset
4 ;; 2009, 2010 Free Software Foundation, Inc.
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
5
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
6 ;; Author: Terry Jones <terry@santafe.edu>
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
7 ;; Keywords: lisp
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
8 ;; Created: 15 December 1995
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
9
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
11
94655
90a2847062be Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
94655
90a2847062be Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
14 ;; the Free Software Foundation, either version 3 of the License, or
90a2847062be Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
15 ;; (at your option) any later version.
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
16
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
20 ;; GNU General Public License for more details.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
21
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
94655
90a2847062be Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
24
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
25 ;;; Commentary:
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14058
diff changeset
26
110924
a134abd52088 Rename another shadow.el function.
Glenn Morris <rgm@gnu.org>
parents: 110851
diff changeset
27 ;; The functions in this file detect (`load-path-shadows-find')
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
28 ;; and display (`list-load-path-shadows') potential load-path
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
29 ;; problems that arise when Emacs Lisp files "shadow" each other.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
30 ;;
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
31 ;; For example, a file XXX.el early in one's load-path will shadow
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
32 ;; a file with the same name in a later load-path directory. When
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
33 ;; this is unintentional, it may result in problems that could have
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
34 ;; been easily avoided. This occurs often (to me) when installing a
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
35 ;; new version of emacs and something in the site-lisp directory
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
36 ;; has been updated and added to the emacs distribution. The old
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
37 ;; version, now outdated, shadows the new one. This is obviously
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
38 ;; undesirable.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
39 ;;
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
40 ;; The `list-load-path-shadows' function was run when you installed
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
41 ;; this version of emacs. To run it by hand in emacs:
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
42 ;;
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
43 ;; M-x list-load-path-shadows
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
44 ;;
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
45 ;; or run it non-interactively via:
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
46 ;;
104021
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
47 ;; emacs -batch -f list-load-path-shadows
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
48 ;;
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
49 ;; Thanks to Francesco Potorti` <pot@cnuce.cnr.it> for suggestions,
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
50 ;; rewritings & speedups.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
51
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
52 ;;; Code:
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
53
48459
f1f792410820 (defgroup lisp-shadow): New group name. Previous group name shadow is
Markus Rost <rost@math.uni-bielefeld.de>
parents: 44203
diff changeset
54 (defgroup lisp-shadow nil
21365
db005054f15d Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19982
diff changeset
55 "Locate Emacs Lisp file shadowings."
110851
3466369fdfcd Rename some shadow.el things.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
56 :prefix "load-path-shadows-"
21365
db005054f15d Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19982
diff changeset
57 :group 'lisp)
db005054f15d Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19982
diff changeset
58
110851
3466369fdfcd Rename some shadow.el things.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
59 (define-obsolete-variable-alias 'shadows-compare-text-p
3466369fdfcd Rename some shadow.el things.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
60 'load-path-shadows-compare-text "23.3")
3466369fdfcd Rename some shadow.el things.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
61
3466369fdfcd Rename some shadow.el things.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
62 (defcustom load-path-shadows-compare-text nil
104021
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
63 "If non-nil, then shadowing files are reported only if their text differs.
21365
db005054f15d Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19982
diff changeset
64 This is slower, but filters out some innocuous shadowing."
db005054f15d Customized.
Stephen Eglen <stephen@gnu.org>
parents: 19982
diff changeset
65 :type 'boolean
48459
f1f792410820 (defgroup lisp-shadow): New group name. Previous group name shadow is
Markus Rost <rost@math.uni-bielefeld.de>
parents: 44203
diff changeset
66 :group 'lisp-shadow)
19982
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
67
110924
a134abd52088 Rename another shadow.el function.
Glenn Morris <rgm@gnu.org>
parents: 110851
diff changeset
68 (defun load-path-shadows-find (&optional path)
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
69 "Return a list of Emacs Lisp files that create shadows.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
70 This function does the work for `list-load-path-shadows'.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
71
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
72 We traverse PATH looking for shadows, and return a \(possibly empty\)
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
73 even-length list of files. A file in this list at position 2i shadows
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
74 the file in position 2i+1. Emacs Lisp file suffixes \(.el and .elc\)
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
75 are stripped from the file names in the list.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
76
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
77 See the documentation for `list-load-path-shadows' for further information."
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
78 (let (true-names ; List of dirs considered.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
79 shadows ; List of shadowings, to be returned.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
80 files ; File names ever seen, with dirs.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
81 dir ; The dir being currently scanned.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
82 curr-files ; This dir's Emacs Lisp files.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
83 orig-dir ; Where the file was first seen.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
84 files-seen-this-dir ; Files seen so far in this dir.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
85 file) ; The current file.
105932
dd099beb5a5b (find-emacs-lisp-shadows, list-load-path-shadows): Use dolist.
Glenn Morris <rgm@gnu.org>
parents: 105372
diff changeset
86 (dolist (pp (or path load-path))
dd099beb5a5b (find-emacs-lisp-shadows, list-load-path-shadows): Use dolist.
Glenn Morris <rgm@gnu.org>
parents: 105372
diff changeset
87 (setq dir (directory-file-name (file-truename (or pp "."))))
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
88 (if (member dir true-names)
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
89 ;; We have already considered this PATH redundant directory.
75508
1809625e8d5c (list-load-path-shadows): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 75346
diff changeset
90 ;; Show the redundancy if we are interactive, unless the PATH
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
91 ;; dir is nil or "." (these redundant directories are just a
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
92 ;; result of the current working directory, and are therefore
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
93 ;; not always redundant).
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
94 (or noninteractive
105932
dd099beb5a5b (find-emacs-lisp-shadows, list-load-path-shadows): Use dolist.
Glenn Morris <rgm@gnu.org>
parents: 105372
diff changeset
95 (and pp
dd099beb5a5b (find-emacs-lisp-shadows, list-load-path-shadows): Use dolist.
Glenn Morris <rgm@gnu.org>
parents: 105372
diff changeset
96 (not (string= pp "."))
dd099beb5a5b (find-emacs-lisp-shadows, list-load-path-shadows): Use dolist.
Glenn Morris <rgm@gnu.org>
parents: 105372
diff changeset
97 (message "Ignoring redundant directory %s" pp)))
19982
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
98
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
99 (setq true-names (append true-names (list dir)))
105932
dd099beb5a5b (find-emacs-lisp-shadows, list-load-path-shadows): Use dolist.
Glenn Morris <rgm@gnu.org>
parents: 105372
diff changeset
100 (setq dir (directory-file-name (or pp ".")))
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
101 (setq curr-files (if (file-accessible-directory-p dir)
67018
ef7892af4fa7 Handle compressed files.
Andreas Schwab <schwab@suse.de>
parents: 64751
diff changeset
102 (directory-files dir nil ".\\.elc?\\(\\.gz\\)?$" t)))
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
103 (and curr-files
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
104 (not noninteractive)
15736
73a325c414a5 (list-load-path-shadows): Fix ambiguous wording.
Karl Heuer <kwzh@gnu.org>
parents: 14348
diff changeset
105 (message "Checking %d files in %s..." (length curr-files) dir))
19982
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
106
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
107 (setq files-seen-this-dir nil)
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
108
105932
dd099beb5a5b (find-emacs-lisp-shadows, list-load-path-shadows): Use dolist.
Glenn Morris <rgm@gnu.org>
parents: 105372
diff changeset
109 (dolist (file curr-files)
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
110
67018
ef7892af4fa7 Handle compressed files.
Andreas Schwab <schwab@suse.de>
parents: 64751
diff changeset
111 (if (string-match "\\.gz$" file)
ef7892af4fa7 Handle compressed files.
Andreas Schwab <schwab@suse.de>
parents: 64751
diff changeset
112 (setq file (substring file 0 -3)))
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
113 (setq file (substring
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
114 file 0 (if (string= (substring file -1) "c") -4 -3)))
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
115
19226
c160218de690 (find-emacs-lisp-shadows): Don't mention `subdirs.el'.
Richard M. Stallman <rms@gnu.org>
parents: 15756
diff changeset
116 ;; FILE now contains the current file name, with no suffix.
c160218de690 (find-emacs-lisp-shadows): Don't mention `subdirs.el'.
Richard M. Stallman <rms@gnu.org>
parents: 15756
diff changeset
117 (unless (or (member file files-seen-this-dir)
c160218de690 (find-emacs-lisp-shadows): Don't mention `subdirs.el'.
Richard M. Stallman <rms@gnu.org>
parents: 15756
diff changeset
118 ;; Ignore these files.
c160218de690 (find-emacs-lisp-shadows): Don't mention `subdirs.el'.
Richard M. Stallman <rms@gnu.org>
parents: 15756
diff changeset
119 (member file '("subdirs")))
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
120 ;; File has not been seen yet in this directory.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
121 ;; This test prevents us declaring that XXX.el shadows
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
122 ;; XXX.elc (or vice-versa) when they are in the same directory.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
123 (setq files-seen-this-dir (cons file files-seen-this-dir))
49598
0d8b17d428b5 Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48459
diff changeset
124
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
125 (if (setq orig-dir (assoc file files))
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
126 ;; This file was seen before, we have a shadowing.
19982
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
127 ;; Report it unless the files are identical.
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
128 (let ((base1 (concat (cdr orig-dir) "/" file))
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
129 (base2 (concat dir "/" file)))
110851
3466369fdfcd Rename some shadow.el things.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
130 (if (not (and load-path-shadows-compare-text
3466369fdfcd Rename some shadow.el things.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
131 (load-path-shadows-same-file-or-nonexistent
19982
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
132 (concat base1 ".el") (concat base2 ".el"))
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
133 ;; This is a bit strict, but safe.
110851
3466369fdfcd Rename some shadow.el things.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
134 (load-path-shadows-same-file-or-nonexistent
19982
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
135 (concat base1 ".elc") (concat base2 ".elc"))))
22170
01df0098b07f Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 21927
diff changeset
136 (setq shadows
01df0098b07f Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 21927
diff changeset
137 (append shadows (list base1 base2)))))
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
138
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
139 ;; Not seen before, add it to the list of seen files.
105932
dd099beb5a5b (find-emacs-lisp-shadows, list-load-path-shadows): Use dolist.
Glenn Morris <rgm@gnu.org>
parents: 105372
diff changeset
140 (setq files (cons (cons file dir) files)))))))
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
141 ;; Return the list of shadowings.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
142 shadows))
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
143
110924
a134abd52088 Rename another shadow.el function.
Glenn Morris <rgm@gnu.org>
parents: 110851
diff changeset
144 (define-obsolete-function-alias 'find-emacs-lisp-shadows
a134abd52088 Rename another shadow.el function.
Glenn Morris <rgm@gnu.org>
parents: 110851
diff changeset
145 'load-path-shadows-find "23.3")
a134abd52088 Rename another shadow.el function.
Glenn Morris <rgm@gnu.org>
parents: 110851
diff changeset
146
19982
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
147 ;; Return true if neither file exists, or if both exist and have identical
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
148 ;; contents.
110851
3466369fdfcd Rename some shadow.el things.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
149 (defun load-path-shadows-same-file-or-nonexistent (f1 f2)
19982
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
150 (let ((exists1 (file-exists-p f1))
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
151 (exists2 (file-exists-p f2)))
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
152 (or (and (not exists1) (not exists2))
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
153 (and exists1 exists2
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
154 (or (equal (file-truename f1) (file-truename f2))
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
155 ;; As a quick test, avoiding spawning a process, compare file
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
156 ;; sizes.
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
157 (and (= (nth 7 (file-attributes f1))
199256234202 (shadows-compare-text-p): Add.
Karl Heuer <kwzh@gnu.org>
parents: 19313
diff changeset
158 (nth 7 (file-attributes f2)))
53477
79093b308520 * progmodes/idlwave.el (idlwave-make-tags):
Eli Zaretskii <eliz@is.elta.co.il>
parents: 52401
diff changeset
159 (eq 0 (call-process "cmp" nil nil nil "-s" f1 f2))))))))
110797
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
160
110807
3c97e9b7b34f Rename some more shadow.el stuff.
Glenn Morris <rgm@gnu.org>
parents: 110806
diff changeset
161 (defvar load-path-shadows-font-lock-keywords
110797
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
162 `((,(format "hides \\(%s.*\\)"
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
163 (file-name-directory (locate-library "simple.el")))
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
164 . (1 font-lock-warning-face)))
110806
62865a8e7f58 Rename shadow-mode.
Glenn Morris <rgm@gnu.org>
parents: 110797
diff changeset
165 "Keywords to highlight in `load-path-shadows-mode'.")
110797
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
166
110806
62865a8e7f58 Rename shadow-mode.
Glenn Morris <rgm@gnu.org>
parents: 110797
diff changeset
167 (define-derived-mode load-path-shadows-mode fundamental-mode "LP-Shadows"
110797
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
168 "Major mode for load-path shadows buffer."
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
169 (set (make-local-variable 'font-lock-defaults)
110807
3c97e9b7b34f Rename some more shadow.el stuff.
Glenn Morris <rgm@gnu.org>
parents: 110806
diff changeset
170 '((load-path-shadows-font-lock-keywords)))
110797
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
171 (setq buffer-undo-list t
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
172 buffer-read-only t))
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
173
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
174 ;; TODO use text-properties instead, a la dired.
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
175 (require 'button)
110807
3c97e9b7b34f Rename some more shadow.el stuff.
Glenn Morris <rgm@gnu.org>
parents: 110806
diff changeset
176 (define-button-type 'load-path-shadows-find-file
110797
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
177 'follow-link t
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
178 ;; 'face 'default
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
179 'action (lambda (button)
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
180 (let ((file (concat (button-get button 'shadow-file) ".el")))
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
181 (or (file-exists-p file)
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
182 (setq file (concat file ".gz")))
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
183 (if (file-readable-p file)
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
184 (pop-to-buffer (find-file-noselect file))
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
185 (error "Cannot read file"))))
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
186 'help-echo "mouse-2, RET: find this file")
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
187
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
188
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
189 ;;;###autoload
104021
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
190 (defun list-load-path-shadows (&optional stringp)
15756
30e9db641e6f (list-load-path-shadows): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 15736
diff changeset
191 "Display a list of Emacs Lisp files that shadow other files.
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
192
104021
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
193 If STRINGP is non-nil, returns any shadows as a string.
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
194 Otherwise, if interactive shows any shadows in a `*Shadows*' buffer;
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
195 else prints messages listing any shadows.
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
196
75508
1809625e8d5c (list-load-path-shadows): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 75346
diff changeset
197 This function lists potential load path problems. Directories in
1809625e8d5c (list-load-path-shadows): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents: 75346
diff changeset
198 the `load-path' variable are searched, in order, for Emacs Lisp
15756
30e9db641e6f (list-load-path-shadows): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 15736
diff changeset
199 files. When a previously encountered file name is found again, a
30e9db641e6f (list-load-path-shadows): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 15736
diff changeset
200 message is displayed indicating that the later file is \"hidden\" by
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
201 the earlier.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
202
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
203 For example, suppose `load-path' is set to
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
204
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
205 \(\"/usr/gnu/emacs/site-lisp\" \"/usr/gnu/emacs/share/emacs/19.30/lisp\"\)
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
206
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
207 and that each of these directories contains a file called XXX.el. Then
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
208 XXX.el in the site-lisp directory is referred to by all of:
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
209 \(require 'XXX\), \(autoload .... \"XXX\"\), \(load-library \"XXX\"\) etc.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
210
73745
06fca0c59a88 (list-load-path-shadows): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 68648
diff changeset
211 The first XXX.el file prevents Emacs from seeing the second \(unless
06fca0c59a88 (list-load-path-shadows): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 68648
diff changeset
212 the second is loaded explicitly via `load-file'\).
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
213
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
214 When not intended, such shadowings can be the source of subtle
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
215 problems. For example, the above situation may have arisen because the
73745
06fca0c59a88 (list-load-path-shadows): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 68648
diff changeset
216 XXX package was not distributed with versions of Emacs prior to
06fca0c59a88 (list-load-path-shadows): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 68648
diff changeset
217 19.30. An Emacs maintainer downloaded XXX from elsewhere and installed
06fca0c59a88 (list-load-path-shadows): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 68648
diff changeset
218 it. Later, XXX was updated and included in the Emacs distribution.
06fca0c59a88 (list-load-path-shadows): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 68648
diff changeset
219 Unless the Emacs maintainer checks for this, the new version of XXX
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
220 will be hidden behind the old \(which may no longer work with the new
73745
06fca0c59a88 (list-load-path-shadows): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 68648
diff changeset
221 Emacs version\).
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
222
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
223 This function performs these checks and flags all possible
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
224 shadowings. Because a .el file may exist without a corresponding .elc
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
225 \(or vice-versa\), these suffixes are essentially ignored. A file
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
226 XXX.elc in an early directory \(that does not contain XXX.el\) is
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
227 considered to shadow a later file XXX.el, and vice-versa.
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
228
104021
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
229 Shadowings are located by calling the (non-interactive) companion
110924
a134abd52088 Rename another shadow.el function.
Glenn Morris <rgm@gnu.org>
parents: 110851
diff changeset
230 function, `load-path-shadows-find'."
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
231 (interactive)
19313
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
232 (let* ((path (copy-sequence load-path))
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
233 (tem path)
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
234 toplevs)
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
235 ;; If we can find simple.el in two places,
105932
dd099beb5a5b (find-emacs-lisp-shadows, list-load-path-shadows): Use dolist.
Glenn Morris <rgm@gnu.org>
parents: 105372
diff changeset
236 (dolist (tt tem)
dd099beb5a5b (find-emacs-lisp-shadows, list-load-path-shadows): Use dolist.
Glenn Morris <rgm@gnu.org>
parents: 105372
diff changeset
237 (if (or (file-exists-p (expand-file-name "simple.el" tt))
dd099beb5a5b (find-emacs-lisp-shadows, list-load-path-shadows): Use dolist.
Glenn Morris <rgm@gnu.org>
parents: 105372
diff changeset
238 (file-exists-p (expand-file-name "simple.el.gz" tt)))
dd099beb5a5b (find-emacs-lisp-shadows, list-load-path-shadows): Use dolist.
Glenn Morris <rgm@gnu.org>
parents: 105372
diff changeset
239 (setq toplevs (cons tt toplevs))))
19313
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
240 (if (> (length toplevs) 1)
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
241 ;; Cut off our copy of load-path right before
44203
621fbfd0bf87 (list-load-path-shadows): Only ignore last copy of standard Lisp
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
242 ;; the last directory which has simple.el in it.
19313
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
243 ;; This avoids loads of duplications between the source dir
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
244 ;; and the dir where these files were copied by installation.
44203
621fbfd0bf87 (list-load-path-shadows): Only ignore last copy of standard Lisp
Richard M. Stallman <rms@gnu.org>
parents: 38436
diff changeset
245 (let ((break (car toplevs)))
19313
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
246 (setq tem path)
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
247 (while tem
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
248 (if (eq (nth 1 tem) break)
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
249 (progn
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
250 (setcdr tem nil)
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
251 (setq tem nil)))
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
252 (setq tem (cdr tem)))))
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
253
110924
a134abd52088 Rename another shadow.el function.
Glenn Morris <rgm@gnu.org>
parents: 110851
diff changeset
254 (let* ((shadows (load-path-shadows-find path))
19313
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
255 (n (/ (length shadows) 2))
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
256 (msg (format "%s Emacs Lisp load-path shadowing%s found"
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
257 (if (zerop n) "No" (concat "\n" (number-to-string n)))
04175c55c49b (list-load-path-shadows): Exclude, from the path we search, all but
Richard M. Stallman <rms@gnu.org>
parents: 19226
diff changeset
258 (if (= n 1) " was" "s were"))))
104021
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
259 (with-temp-buffer
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
260 (while shadows
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
261 (insert (format "%s hides %s\n" (car shadows)
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
262 (car (cdr shadows))))
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
263 (setq shadows (cdr (cdr shadows))))
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
264 (if stringp
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
265 (buffer-string)
105372
bd2966850aac Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents: 104021
diff changeset
266 (if (called-interactively-p 'interactive)
105932
dd099beb5a5b (find-emacs-lisp-shadows, list-load-path-shadows): Use dolist.
Glenn Morris <rgm@gnu.org>
parents: 105372
diff changeset
267 ;; We are interactive.
dd099beb5a5b (find-emacs-lisp-shadows, list-load-path-shadows): Use dolist.
Glenn Morris <rgm@gnu.org>
parents: 105372
diff changeset
268 ;; Create the *Shadows* buffer and display shadowings there.
dd099beb5a5b (find-emacs-lisp-shadows, list-load-path-shadows): Use dolist.
Glenn Morris <rgm@gnu.org>
parents: 105372
diff changeset
269 (let ((string (buffer-string)))
dd099beb5a5b (find-emacs-lisp-shadows, list-load-path-shadows): Use dolist.
Glenn Morris <rgm@gnu.org>
parents: 105372
diff changeset
270 (with-current-buffer (get-buffer-create "*Shadows*")
dd099beb5a5b (find-emacs-lisp-shadows, list-load-path-shadows): Use dolist.
Glenn Morris <rgm@gnu.org>
parents: 105372
diff changeset
271 (display-buffer (current-buffer))
110806
62865a8e7f58 Rename shadow-mode.
Glenn Morris <rgm@gnu.org>
parents: 110797
diff changeset
272 (load-path-shadows-mode) ; run after-change-major-mode-hook
110797
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
273 (let ((inhibit-read-only t))
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
274 (erase-buffer)
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
275 (insert string)
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
276 (insert msg "\n")
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
277 (while (re-search-backward "\\(^.*\\) hides \\(.*$\\)"
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
278 nil t)
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
279 (dotimes (i 2)
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
280 (make-button (match-beginning (1+ i))
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
281 (match-end (1+ i))
110807
3c97e9b7b34f Rename some more shadow.el stuff.
Glenn Morris <rgm@gnu.org>
parents: 110806
diff changeset
282 'type 'load-path-shadows-find-file
3c97e9b7b34f Rename some more shadow.el stuff.
Glenn Morris <rgm@gnu.org>
parents: 110806
diff changeset
283 'shadow-file
110797
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
284 (match-string (1+ i)))))
2343b29e1e8d Add a shadow-mode for load-path shadows.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
285 (goto-char (point-max)))))
104021
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
286 ;; We are non-interactive, print shadows via message.
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
287 (unless (zerop n)
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
288 (message "This site has duplicate Lisp libraries with the same name.
19226
c160218de690 (find-emacs-lisp-shadows): Don't mention `subdirs.el'.
Richard M. Stallman <rms@gnu.org>
parents: 15756
diff changeset
289 If a locally-installed Lisp library overrides a library in the Emacs release,
c160218de690 (find-emacs-lisp-shadows): Don't mention `subdirs.el'.
Richard M. Stallman <rms@gnu.org>
parents: 15756
diff changeset
290 that can cause trouble, and you should probably remove the locally-installed
21927
8332fee2c358 (list-load-path-shadows): Don't say
Richard M. Stallman <rms@gnu.org>
parents: 21365
diff changeset
291 version unless you know what you are doing.\n")
104021
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
292 (goto-char (point-min))
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
293 ;; Mimic the previous behavior of using lots of messages.
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
294 ;; I think one single message would look better...
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
295 (while (not (eobp))
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
296 (message "%s" (buffer-substring (line-beginning-position)
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
297 (line-end-position)))
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
298 (forward-line 1))
94f1fe5b7430 (shadows-compare-text-p): Remove leading * from defcustom doc.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
299 (message "%s" msg))))))))
14058
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
300
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
301 (provide 'shadow)
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
302
be8c739308f7 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
303 ;;; shadow.el ends here