Merge from emacs-24; up to 2012-12-24T15:56:17Z!eliz@gnu.org
[bpt/emacs.git] / lisp / cus-dep.el
index 5e74c68..60b4273 100644 (file)
@@ -1,6 +1,6 @@
 ;;; cus-dep.el --- find customization dependencies
 ;;
-;; Copyright (C) 1997, 2001-201 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2013 Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: internal
@@ -25,7 +25,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 (require 'widget)
 (require 'cus-face)
 
@@ -42,17 +41,18 @@ ldefs-boot\\|cus-load\\|finder-inf\\|esh-groups\\|subdirs\\)\\.el$\\)"
 (defun custom-make-dependencies ()
   "Batch function to extract custom dependencies from .el files.
 Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS"
-  (let ((enable-local-eval nil))
+  (let ((enable-local-eval nil)
+       subdir)
     (with-temp-buffer
-      (dolist (subdir command-line-args-left)
+      ;; Use up command-line-args-left else Emacs can try to open
+      ;; the args as directories after we are done.
+      (while (setq subdir (pop command-line-args-left))
         (message "Directory %s" subdir)
         (let ((files (directory-files subdir nil "\\`[^=].*\\.el\\'"))
               (default-directory (expand-file-name subdir))
               (preloaded (concat "\\`"
                                  (regexp-opt (mapcar
-                                              (lambda (f)
-                                                (file-name-sans-extension
-                                                 (file-name-nondirectory f)))
+                                              'file-name-base
                                               preloaded-file-list) t)
                                  "\\.el\\'")))
           (dolist (file files)