diff options
| author | Glenn Morris | 2009-07-22 02:34:11 +0000 |
|---|---|---|
| committer | Glenn Morris | 2009-07-22 02:34:11 +0000 |
| commit | 7ba65108e5acf2a806339bb83e6a6c2c38177eb2 (patch) | |
| tree | 1ac94149b12402752e66c5259d8627a01281019e | |
| parent | 7ff9d47331484469fd668f9be2a4e47df5a2b38d (diff) | |
| download | emacs-7ba65108e5acf2a806339bb83e6a6c2c38177eb2.tar.gz emacs-7ba65108e5acf2a806339bb83e6a6c2c38177eb2.zip | |
(shadows-compare-text-p): Remove leading * from defcustom doc.
(list-load-path-shadows): Optionally, just return shadows as a string.
| -rw-r--r-- | lisp/emacs-lisp/shadow.el | 70 |
1 files changed, 40 insertions, 30 deletions
diff --git a/lisp/emacs-lisp/shadow.el b/lisp/emacs-lisp/shadow.el index 9b3f60ff75c..62feb15939d 100644 --- a/lisp/emacs-lisp/shadow.el +++ b/lisp/emacs-lisp/shadow.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; shadow.el --- locate Emacs Lisp file shadowings | 1 | ;;; shadow.el --- locate Emacs Lisp file shadowings |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005, | 3 | ;; Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, |
| 4 | ;; 2006, 2007, 2008, 2009 Free Software Foundation, Inc. | 4 | ;; 2009 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Author: Terry Jones <terry@santafe.edu> | 6 | ;; Author: Terry Jones <terry@santafe.edu> |
| 7 | ;; Keywords: lisp | 7 | ;; Keywords: lisp |
| @@ -40,12 +40,11 @@ | |||
| 40 | ;; The `list-load-path-shadows' function was run when you installed | 40 | ;; The `list-load-path-shadows' function was run when you installed |
| 41 | ;; this version of emacs. To run it by hand in emacs: | 41 | ;; this version of emacs. To run it by hand in emacs: |
| 42 | ;; | 42 | ;; |
| 43 | ;; M-x load-library RET shadow RET | ||
| 44 | ;; M-x list-load-path-shadows | 43 | ;; M-x list-load-path-shadows |
| 45 | ;; | 44 | ;; |
| 46 | ;; or run it non-interactively via: | 45 | ;; or run it non-interactively via: |
| 47 | ;; | 46 | ;; |
| 48 | ;; emacs -batch -l shadow.el -f list-load-path-shadows | 47 | ;; emacs -batch -f list-load-path-shadows |
| 49 | ;; | 48 | ;; |
| 50 | ;; Thanks to Francesco Potorti` <pot@cnuce.cnr.it> for suggestions, | 49 | ;; Thanks to Francesco Potorti` <pot@cnuce.cnr.it> for suggestions, |
| 51 | ;; rewritings & speedups. | 50 | ;; rewritings & speedups. |
| @@ -58,7 +57,7 @@ | |||
| 58 | :group 'lisp) | 57 | :group 'lisp) |
| 59 | 58 | ||
| 60 | (defcustom shadows-compare-text-p nil | 59 | (defcustom shadows-compare-text-p nil |
| 61 | "*If non-nil, then shadowing files are reported only if their text differs. | 60 | "If non-nil, then shadowing files are reported only if their text differs. |
| 62 | This is slower, but filters out some innocuous shadowing." | 61 | This is slower, but filters out some innocuous shadowing." |
| 63 | :type 'boolean | 62 | :type 'boolean |
| 64 | :group 'lisp-shadow) | 63 | :group 'lisp-shadow) |
| @@ -165,9 +164,13 @@ See the documentation for `list-load-path-shadows' for further information." | |||
| 165 | (eq 0 (call-process "cmp" nil nil nil "-s" f1 f2)))))))) | 164 | (eq 0 (call-process "cmp" nil nil nil "-s" f1 f2)))))))) |
| 166 | 165 | ||
| 167 | ;;;###autoload | 166 | ;;;###autoload |
| 168 | (defun list-load-path-shadows () | 167 | (defun list-load-path-shadows (&optional stringp) |
| 169 | "Display a list of Emacs Lisp files that shadow other files. | 168 | "Display a list of Emacs Lisp files that shadow other files. |
| 170 | 169 | ||
| 170 | If STRINGP is non-nil, returns any shadows as a string. | ||
| 171 | Otherwise, if interactive shows any shadows in a `*Shadows*' buffer; | ||
| 172 | else prints messages listing any shadows. | ||
| 173 | |||
| 171 | This function lists potential load path problems. Directories in | 174 | This function lists potential load path problems. Directories in |
| 172 | the `load-path' variable are searched, in order, for Emacs Lisp | 175 | the `load-path' variable are searched, in order, for Emacs Lisp |
| 173 | files. When a previously encountered file name is found again, a | 176 | files. When a previously encountered file name is found again, a |
| @@ -200,10 +203,8 @@ shadowings. Because a .el file may exist without a corresponding .elc | |||
| 200 | XXX.elc in an early directory \(that does not contain XXX.el\) is | 203 | XXX.elc in an early directory \(that does not contain XXX.el\) is |
| 201 | considered to shadow a later file XXX.el, and vice-versa. | 204 | considered to shadow a later file XXX.el, and vice-versa. |
| 202 | 205 | ||
| 203 | When run interactively, the shadowings \(if any\) are displayed in a | 206 | Shadowings are located by calling the (non-interactive) companion |
| 204 | buffer called `*Shadows*'. Shadowings are located by calling the | 207 | function, `find-emacs-lisp-shadows'." |
| 205 | \(non-interactive\) companion function, `find-emacs-lisp-shadows'." | ||
| 206 | |||
| 207 | (interactive) | 208 | (interactive) |
| 208 | (let* ((path (copy-sequence load-path)) | 209 | (let* ((path (copy-sequence load-path)) |
| 209 | (tem path) | 210 | (tem path) |
| @@ -233,29 +234,38 @@ buffer called `*Shadows*'. Shadowings are located by calling the | |||
| 233 | (msg (format "%s Emacs Lisp load-path shadowing%s found" | 234 | (msg (format "%s Emacs Lisp load-path shadowing%s found" |
| 234 | (if (zerop n) "No" (concat "\n" (number-to-string n))) | 235 | (if (zerop n) "No" (concat "\n" (number-to-string n))) |
| 235 | (if (= n 1) " was" "s were")))) | 236 | (if (= n 1) " was" "s were")))) |
| 236 | (if (interactive-p) | 237 | (with-temp-buffer |
| 237 | (save-excursion | 238 | (while shadows |
| 238 | ;; We are interactive. | 239 | (insert (format "%s hides %s\n" (car shadows) |
| 239 | ;; Create the *Shadows* buffer and display shadowings there. | 240 | (car (cdr shadows)))) |
| 240 | (let ((output-buffer (get-buffer-create "*Shadows*"))) | 241 | (setq shadows (cdr (cdr shadows)))) |
| 241 | (display-buffer output-buffer) | 242 | (if stringp |
| 242 | (set-buffer output-buffer) | 243 | (buffer-string) |
| 243 | (erase-buffer) | 244 | (if (interactive-p) |
| 244 | (while shadows | 245 | (save-excursion |
| 245 | (insert (format "%s hides %s\n" (car shadows) | 246 | ;; We are interactive. |
| 246 | (car (cdr shadows)))) | 247 | ;; Create the *Shadows* buffer and display shadowings there. |
| 247 | (setq shadows (cdr (cdr shadows)))) | 248 | (let ((string (buffer-string)) |
| 248 | (insert msg "\n"))) | 249 | (output-buffer (get-buffer-create "*Shadows*"))) |
| 249 | ;; We are non-interactive, print shadows via message. | 250 | (display-buffer output-buffer) |
| 250 | (when shadows | 251 | (set-buffer output-buffer) |
| 251 | (message "This site has duplicate Lisp libraries with the same name. | 252 | (erase-buffer) |
| 253 | (insert string) | ||
| 254 | (insert msg "\n"))) | ||
| 255 | ;; We are non-interactive, print shadows via message. | ||
| 256 | (unless (zerop n) | ||
| 257 | (message "This site has duplicate Lisp libraries with the same name. | ||
| 252 | If a locally-installed Lisp library overrides a library in the Emacs release, | 258 | If a locally-installed Lisp library overrides a library in the Emacs release, |
| 253 | that can cause trouble, and you should probably remove the locally-installed | 259 | that can cause trouble, and you should probably remove the locally-installed |
| 254 | version unless you know what you are doing.\n") | 260 | version unless you know what you are doing.\n") |
| 255 | (while shadows | 261 | (goto-char (point-min)) |
| 256 | (message "%s hides %s" (car shadows) (car (cdr shadows))) | 262 | ;; Mimic the previous behavior of using lots of messages. |
| 257 | (setq shadows (cdr (cdr shadows)))) | 263 | ;; I think one single message would look better... |
| 258 | (message "%s" msg)))))) | 264 | (while (not (eobp)) |
| 265 | (message "%s" (buffer-substring (line-beginning-position) | ||
| 266 | (line-end-position))) | ||
| 267 | (forward-line 1)) | ||
| 268 | (message "%s" msg)))))))) | ||
| 259 | 269 | ||
| 260 | (provide 'shadow) | 270 | (provide 'shadow) |
| 261 | 271 | ||