]> code.delx.au - gnu-emacs/blobdiff - lisp/cus-dep.el
Merge from trunk.
[gnu-emacs] / lisp / cus-dep.el
index 230410772ab8464a4271dffc248e67248346fef3..fd679ee30882c70175377a2f0776b114399de2ac 100644 (file)
@@ -1,7 +1,6 @@
 ;;; cus-dep.el --- find customization dependencies
 ;;
-;; Copyright (C) 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-;;   2008, 2009, 2010  Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2013 Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: internal
@@ -26,7 +25,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 (require 'widget)
 (require 'cus-face)
 
@@ -40,20 +38,33 @@ ldefs-boot\\|cus-load\\|finder-inf\\|esh-groups\\|subdirs\\)\\.el$\\)"
 
 (autoload 'autoload-rubric "autoload")
 
+(defun set-generated-custom-dependencies-file (file)
+  "Set value of `generated-custom-dependencies-file' from FILE.
+
+On systems other than MS-Windows, just sets the value
+of `generated-custom-dependencies-file'.  On MS-Windows, converts
+/d/foo/bar form passed by MSYS Make into d:/foo/bar that Emacs can
+grok.  This function is called from lisp/Makefile."
+  (when (and (eq system-type 'windows-nt)
+            (string-match "\\`/[a-zA-Z]/" file))
+    (setq file (concat (substring file 1 2) ":" (substring file 2))))
+  (setq generated-custom-dependencies-file file))
+
 (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)
@@ -172,5 +183,4 @@ Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS"
 
 \f
 
-;; arch-tag: b7b6421a-bf7a-44fd-a382-6f44976bdf68
 ;;; cus-dep.el ends here