diff options
| author | Per Abrahamsen | 1997-04-11 13:09:47 +0000 |
|---|---|---|
| committer | Per Abrahamsen | 1997-04-11 13:09:47 +0000 |
| commit | 860af8ecb1e102392a92f868175252bc3e06f561 (patch) | |
| tree | 19be0b5ee135f0c4fca4162286e13223f34c23e1 | |
| parent | c7685c8dfaeab80e375337861e7504acb65c8e88 (diff) | |
| download | emacs-860af8ecb1e102392a92f868175252bc3e06f561.tar.gz emacs-860af8ecb1e102392a92f868175252bc3e06f561.zip | |
Initial revision
| -rw-r--r-- | lisp/cus-dep.el | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/lisp/cus-dep.el b/lisp/cus-dep.el new file mode 100644 index 00000000000..d2364c29029 --- /dev/null +++ b/lisp/cus-dep.el | |||
| @@ -0,0 +1,67 @@ | |||
| 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 | ||