Mercurial > emacs
comparison lisp/cus-dep.el @ 22538:2649d061d370
*** empty log message ***
author | Dan Nicolaescu <done@ece.arizona.edu> |
---|---|
date | Mon, 22 Jun 1998 02:10:41 +0000 |
parents | 44c9237d9e52 |
children | 3da8188c31a3 |
comparison
equal
deleted
inserted
replaced
22537:7947a4ea28a8 | 22538:2649d061d370 |
---|---|
25 ;;; Code: | 25 ;;; Code: |
26 | 26 |
27 (require 'cl) | 27 (require 'cl) |
28 (require 'widget) | 28 (require 'widget) |
29 (require 'cus-face) | 29 (require 'cus-face) |
30 (require 'autoload) | |
30 | 31 |
31 (defun custom-make-dependencies () | 32 (defun custom-make-dependencies () |
32 "Batch function to extract custom dependencies from .el files. | 33 "Batch function to extract custom dependencies from .el files. |
33 Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS" | 34 Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS" |
34 (let ((enable-local-eval nil) | 35 (let ((enable-local-eval nil) |
38 (set-buffer " cus-dep temp") | 39 (set-buffer " cus-dep temp") |
39 (while all-subdirs | 40 (while all-subdirs |
40 (message "Directory %s" (car all-subdirs)) | 41 (message "Directory %s" (car all-subdirs)) |
41 (let ((files (directory-files (car all-subdirs) nil "\\`[^=].*\\.el\\'")) | 42 (let ((files (directory-files (car all-subdirs) nil "\\`[^=].*\\.el\\'")) |
42 (default-directory default-directory) | 43 (default-directory default-directory) |
43 file) | 44 file |
45 is-autoloaded) | |
44 (cd (car all-subdirs)) | 46 (cd (car all-subdirs)) |
45 (while files | 47 (while files |
46 (setq file (car files) | 48 (setq file (car files) |
47 files (cdr files)) | 49 files (cdr files)) |
48 (when (file-exists-p file) | 50 (when (file-exists-p file) |
52 (string-match "\\`\\(.*\\)\\.el\\'" file) | 54 (string-match "\\`\\(.*\\)\\.el\\'" file) |
53 (let ((name (file-name-nondirectory (match-string 1 file)))) | 55 (let ((name (file-name-nondirectory (match-string 1 file)))) |
54 (condition-case nil | 56 (condition-case nil |
55 (while (re-search-forward "^(defcustom\\|^(defface\\|^(defgroup" | 57 (while (re-search-forward "^(defcustom\\|^(defface\\|^(defgroup" |
56 nil t) | 58 nil t) |
59 (setq is-autoloaded nil) | |
57 (beginning-of-line) | 60 (beginning-of-line) |
61 (save-excursion | |
62 (forward-line -1) | |
63 (if (looking-at generate-autoload-cookie) | |
64 (setq is-autoloaded t))) | |
58 (let ((expr (read (current-buffer)))) | 65 (let ((expr (read (current-buffer)))) |
59 (condition-case nil | 66 (condition-case nil |
60 (progn | 67 (progn |
61 (eval expr) | 68 (eval expr) |
69 (put (nth 1 expr) 'custom-autoloaded is-autoloaded) | |
62 (put (nth 1 expr) 'custom-where name)) | 70 (put (nth 1 expr) 'custom-where name)) |
63 (error nil)))) | 71 (error nil)))) |
64 (error nil))))) | 72 (error nil))))) |
65 (setq all-subdirs (cdr all-subdirs))))) | 73 (setq all-subdirs (cdr all-subdirs))))) |
66 (message "Generating cus-load.el...") | 74 (message "Generating cus-load.el...") |
89 (prin1 where (current-buffer)) | 97 (prin1 where (current-buffer)) |
90 (push where found))) | 98 (push where found))) |
91 (when found | 99 (when found |
92 (insert "))\n")))))) | 100 (insert "))\n")))))) |
93 (insert "\ | 101 (insert "\ |
102 ;;; These are for handling :version. We need to have a minimum of | |
103 ;;; information so `custom-changed-variables' could do its job. | |
104 ;;; For both groups and variables we have to set `custom-version'. | |
105 ;;; For variables we also set the `standard-value' and for groups | |
106 ;;; `group-documentation' (which is shown in the customize buffer, so | |
107 ;;; we don't have to load the file containing the group. | |
108 | |
109 ;;; `custom-versions-load-alist' is an alist that has as car a version | |
110 ;;; number and as elts the files that have variables that contain that | |
111 ;;; version. These files should be loaded before showing the | |
112 ;;; customization buffer that `customize-changed-options' generates. | |
113 | |
114 | |
115 ;;; This macro is used so we don't modify the information about | |
116 ;;; variables and groups if it's already set. (We don't know when | |
117 ;;; cus-load.el is going to be loaded and at that time some of the | |
118 ;;; files might be loaded and some others might not). | |
119 (defmacro custom-put-if-not (symbol propname value) | |
120 `(unless (get ,symbol ,propname) | |
121 (put ,symbol ,propname ,value))) | |
122 | |
123 ") | |
124 (let ((version-alist nil)) | |
125 (mapatoms (lambda (symbol) | |
126 (let ((version (get symbol 'custom-version)) | |
127 where) | |
128 (when version | |
129 (setq where (get symbol 'custom-where)) | |
130 (when (and where | |
131 ;; Don't bother to do anything if it's | |
132 ;; autoloaded because we will have all | |
133 ;; this info when emacs is running | |
134 ;; anyway. | |
135 (not (get symbol 'custom-autoloaded))) | |
136 (insert "(custom-put-if-not '" (symbol-name symbol) | |
137 " 'custom-version ") | |
138 (prin1 version (current-buffer)) | |
139 (insert ")\n") | |
140 (insert "(put '" (symbol-name symbol)) | |
141 (if (get symbol 'standard-value) | |
142 ;; This means it's a variable | |
143 (progn | |
144 (insert " 'standard-value t)\n") | |
145 (if (assoc version version-alist) | |
146 (unless | |
147 (member where | |
148 (cdr (assoc version version-alist))) | |
149 (push where (cdr (assoc version version-alist)))) | |
150 (push (cons version (list where)) version-alist))) | |
151 ;; This is a group | |
152 (insert " 'group-documentation ") | |
153 (prin1 (get symbol 'group-documentation) (current-buffer)) | |
154 (insert ")\n"))))))) | |
155 | |
156 (insert "\n(defvar custom-versions-load-alist " | |
157 (if version-alist "'" "")) | |
158 (prin1 version-alist (current-buffer)) | |
159 (insert "\n \"For internal use by custom.\")\n")) | |
160 | |
161 (insert "\ | |
94 | 162 |
95 \(provide 'cus-load) | 163 \(provide 'cus-load) |
96 | 164 |
97 ;;; cus-load.el ends here\n") | 165 ;;; cus-load.el ends here\n") |
98 (let ((kept-new-versions 10000000)) | 166 (let ((kept-new-versions 10000000)) |