;;; shadow.el --- locate Emacs Lisp file shadowings
-;; Copyright (C) 1995 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005,
+;; 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
;; Author: Terry Jones <terry@santafe.edu>
;; Keywords: lisp
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
(setq dir (directory-file-name (file-truename (or (car path) "."))))
(if (member dir true-names)
;; We have already considered this PATH redundant directory.
- ;; Show the redundancy if we are interactiver, unless the PATH
+ ;; Show the redundancy if we are interactive, unless the PATH
;; dir is nil or "." (these redundant directories are just a
;; result of the current working directory, and are therefore
;; not always redundant).
(setq true-names (append true-names (list dir)))
(setq dir (directory-file-name (or (car path) ".")))
(setq curr-files (if (file-accessible-directory-p dir)
- (directory-files dir nil ".\\.elc?$" t)))
+ (directory-files dir nil ".\\.elc?\\(\\.gz\\)?$" t)))
(and curr-files
(not noninteractive)
(message "Checking %d files in %s..." (length curr-files) dir))
(while curr-files
(setq file (car curr-files))
+ (if (string-match "\\.gz$" file)
+ (setq file (substring file 0 -3)))
(setq file (substring
file 0 (if (string= (substring file -1) "c") -4 -3)))
(defun list-load-path-shadows ()
"Display a list of Emacs Lisp files that shadow other files.
-This function lists potential load-path problems. Directories in the
-`load-path' variable are searched, in order, for Emacs Lisp
+This function lists potential load path problems. Directories in
+the `load-path' variable are searched, in order, for Emacs Lisp
files. When a previously encountered file name is found again, a
message is displayed indicating that the later file is \"hidden\" by
the earlier.
XXX.el in the site-lisp directory is referred to by all of:
\(require 'XXX\), \(autoload .... \"XXX\"\), \(load-library \"XXX\"\) etc.
-The first XXX.el file prevents emacs from seeing the second \(unless
-the second is loaded explicitly via load-file\).
+The first XXX.el file prevents Emacs from seeing the second \(unless
+the second is loaded explicitly via `load-file'\).
When not intended, such shadowings can be the source of subtle
problems. For example, the above situation may have arisen because the
-XXX package was not distributed with versions of emacs prior to
-19.30. An emacs maintainer downloaded XXX from elsewhere and installed
-it. Later, XXX was updated and included in the emacs distribution.
-Unless the emacs maintainer checks for this, the new version of XXX
+XXX package was not distributed with versions of Emacs prior to
+19.30. An Emacs maintainer downloaded XXX from elsewhere and installed
+it. Later, XXX was updated and included in the Emacs distribution.
+Unless the Emacs maintainer checks for this, the new version of XXX
will be hidden behind the old \(which may no longer work with the new
-emacs version\).
+Emacs version\).
This function performs these checks and flags all possible
shadowings. Because a .el file may exist without a corresponding .elc
toplevs)
;; If we can find simple.el in two places,
(while tem
- (if (file-exists-p (expand-file-name "simple.el" (car tem)))
+ (if (or (file-exists-p (expand-file-name "simple.el" (car tem)))
+ (file-exists-p (expand-file-name "simple.el.gz" (car tem))))
(setq toplevs (cons (car tem) toplevs)))
(setq tem (cdr tem)))
(if (> (length toplevs) 1)
(provide 'shadow)
-;;; arch-tag: 0480e8a7-62ed-4a12-a9f6-f44ded9b0830
+;; arch-tag: 0480e8a7-62ed-4a12-a9f6-f44ded9b0830
;;; shadow.el ends here