1 ;;; cus-dep.el --- Find customization dependencies.
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
31 (defun custom-make-dependencies ()
32 "Batch function to extract custom dependencies from .el files.
33 Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS"
34 (let ((enable-local-eval nil
)
35 (all-subdirs command-line-args-left
)
36 (start-directory default-directory
))
37 (get-buffer-create " cus-dep temp")
38 (set-buffer " cus-dep temp")
40 (message "Directory %s" (car all-subdirs
))
41 (let ((files (directory-files (car all-subdirs
) nil
"\\`[^=].*\\.el\\'"))
42 (default-directory default-directory
)
44 (cd (car all-subdirs
))
46 (setq file
(car files
)
48 (when (file-exists-p file
)
49 (message "Checking %s..." file
)
51 (insert-file-contents file
)
52 (goto-char (point-min))
53 (string-match "\\`\\(.*\\)\\.el\\'" file
)
54 (let ((name (file-name-nondirectory (match-string 1 file
))))
56 (while (re-search-forward "^(defcustom\\|^(defface\\|^(defgroup"
59 (let ((expr (read (current-buffer))))
61 (put (nth 1 expr
) 'custom-where name
)))
63 (setq all-subdirs
(cdr all-subdirs
)))))
64 (message "Generating cus-load.el...")
65 (find-file "cus-load.el")
68 ;;; cus-load.el --- automatically extracted custom dependencies
73 (mapatoms (lambda (symbol)
74 (let ((members (get symbol
'custom-group
))
78 (setq item
(car (car members
))
80 where
(get item
'custom-where
))
81 (unless (or (null where
)
85 (insert "(put '" (symbol-name symbol
)
87 (prin1 where
(current-buffer))
95 ;;; cus-load.el ends here\n")
96 (let ((kept-new-versions 10000000))
98 (message "Generating cus-load.el...done")
101 ;;; cus-dep.el ends here