a733da89d79ab319e685a7febd785735d4209865
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"
34 (let ((enable-local-eval nil
)
36 (start-directory default-directory
))
37 (get-buffer-create " cus-dep temp")
38 (set-buffer " cus-dep temp")
41 (let ((this (car pending
))
44 (setq all-subdirs
(cons this all-subdirs
))
45 (setq pending
(cdr pending
))
46 (setq default-directory
47 (expand-file-name this start-directory
))
48 (message "Finding subdirs of %s" this
)
52 (insert-file-contents "subdirs.el")
53 (goto-char (point-min))
56 (setq this-subdirs
(read (current-buffer)))
57 (setq pending
(nconc pending
59 (function (lambda (dir)
61 (file-name-as-directory
62 (expand-file-name dir this
))
68 (message "Directory %s" (car all-subdirs
))
69 (let ((files (directory-files (car all-subdirs
) nil
"\\`[^=].*\\.el\\'"))
70 (default-directory default-directory
)
72 (cd (car all-subdirs
))
74 (setq file
(car files
)
76 (message "Checking %s..." file
)
78 (insert-file-contents file
)
79 (goto-char (point-min))
80 (string-match "\\`\\(.*\\)\\.el\\'" file
)
81 (let ((name (file-name-nondirectory (match-string 1 file
))))
83 (while (re-search-forward "^(defcustom\\|^(defface\\|^(defgroup"
86 (let ((expr (read (current-buffer))))
88 (put (nth 1 expr
) 'custom-where name
)))
90 (setq all-subdirs
(cdr all-subdirs
)))))
91 (message "Generating cus-load.el...")
92 (find-file "cus-load.el")
95 ;;; cus-load.el --- automatically extracted custom dependencies
100 (mapatoms (lambda (symbol)
101 (let ((members (get symbol
'custom-group
))
105 (setq item
(car (car members
))
106 members
(cdr members
)
107 where
(get item
'custom-where
))
108 (unless (or (null where
)
109 (member where found
))
112 (insert "(put '" (symbol-name symbol
)
113 " 'custom-loads '("))
114 (prin1 where
(current-buffer))
122 ;;; cus-load.el ends here\n")
123 (let ((kept-new-versions 10000000))
125 (message "Generating cus-load.el...done"))
127 ;;; cus-dep.el ends here