comparison lisp/cus-dep.el @ 17393:14c7f7b87c22

Initial revision
author Per Abrahamsen <abraham@dina.kvl.dk>
date Fri, 11 Apr 1997 13:09:47 +0000
parents
children ad9d92edda0d
comparison
equal deleted inserted replaced
17392:7cb4b3489fac 17393:14c7f7b87c22
1 ;;; cus-dep.el --- Find customization dependencies.
2 ;;
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
4 ;;
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
6 ;; Keywords: internal
7
8 ;;; Code:
9
10 (require 'cl)
11 (load-file "widget.el")
12 (load-file "custom.el")
13 (load-file "cus-face.el")
14
15 (defun custom-make-dependencies ()
16 "Batch function to extract custom dependencies from .el files.
17 Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies"
18 (let ((enable-local-eval nil)
19 (files (directory-files "" nil "\\`[^=].*\\.el\\'" t))
20 file)
21 (while files
22 (setq file (car files)
23 files (cdr files))
24 (message "Checking %s..." file)
25 (set-buffer (find-file-noselect file))
26 (goto-char (point-min))
27 (string-match "\\`\\(.*\\)\\.el\\'" file)
28 (condition-case nil
29 (let ((name (file-name-nondirectory (match-string 1 file))))
30 (while t
31 (let ((expr (read (current-buffer))))
32 (when (and (listp expr)
33 (memq (car expr) '(defcustom defface defgroup)))
34 (eval expr)
35 (put (nth 1 expr) 'custom-where name)))))
36 (error nil))
37 (kill-buffer (current-buffer))))
38 (message "Generating cus-load.el...")
39 (find-file "cus-load.el")
40 (erase-buffer)
41 (insert "\
42 ;;; cus-load.el --- automatically extracted custom dependencies
43 ;;
44 ;;; Code:
45 ")
46 (mapatoms (lambda (symbol)
47 (let ((members (get symbol 'custom-group))
48 item where found)
49 (when members
50 (while members
51 (setq item (car (car members))
52 members (cdr members)
53 where (get item 'custom-where))
54 (unless (or (null where)
55 (member where found))
56 (if found
57 (insert " ")
58 (insert "(put '" (symbol-name symbol)
59 " 'custom-loads '("))
60 (insert (prin1-to-string where))
61 (push where found)))
62 (insert "))\n")))))
63 (insert "\n;;; cus-load.el ends here\n")
64 (save-buffer)
65 (message "Generating cus-load.el..."))
66
67 ;;; cus-dep.el ends here