Mercurial > emacs
annotate lisp/cus-dep.el @ 20958:806727604be8
(Fdelete_backward_char): Count both bytes and chars.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Sun, 22 Feb 1998 01:06:06 +0000 |
parents | bbad6a02f725 |
children | 44c9237d9e52 |
rev | line source |
---|---|
17393 | 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 | |
17520 | 8 ;; This file is part of GNU Emacs. |
9 | |
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) | |
13 ;; any later version. | |
14 | |
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. | |
19 | |
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. | |
24 | |
17393 | 25 ;;; Code: |
26 | |
27 (require 'cl) | |
17685
3a1471ba9387
(custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents:
17520
diff
changeset
|
28 (require 'widget) |
3a1471ba9387
(custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents:
17520
diff
changeset
|
29 (require 'cus-face) |
17393 | 30 |
31 (defun custom-make-dependencies () | |
32 "Batch function to extract custom dependencies from .el files. | |
17744
2522a70cd009
(custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents:
17685
diff
changeset
|
33 Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS" |
17393 | 34 (let ((enable-local-eval nil) |
17744
2522a70cd009
(custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents:
17685
diff
changeset
|
35 (all-subdirs command-line-args-left) |
17685
3a1471ba9387
(custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents:
17520
diff
changeset
|
36 (start-directory default-directory)) |
3a1471ba9387
(custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents:
17520
diff
changeset
|
37 (get-buffer-create " cus-dep temp") |
3a1471ba9387
(custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents:
17520
diff
changeset
|
38 (set-buffer " cus-dep temp") |
3a1471ba9387
(custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents:
17520
diff
changeset
|
39 (while all-subdirs |
3a1471ba9387
(custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents:
17520
diff
changeset
|
40 (message "Directory %s" (car all-subdirs)) |
3a1471ba9387
(custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents:
17520
diff
changeset
|
41 (let ((files (directory-files (car all-subdirs) nil "\\`[^=].*\\.el\\'")) |
3a1471ba9387
(custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents:
17520
diff
changeset
|
42 (default-directory default-directory) |
3a1471ba9387
(custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents:
17520
diff
changeset
|
43 file) |
3a1471ba9387
(custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents:
17520
diff
changeset
|
44 (cd (car all-subdirs)) |
3a1471ba9387
(custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents:
17520
diff
changeset
|
45 (while files |
3a1471ba9387
(custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents:
17520
diff
changeset
|
46 (setq file (car files) |
3a1471ba9387
(custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents:
17520
diff
changeset
|
47 files (cdr files)) |
17744
2522a70cd009
(custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents:
17685
diff
changeset
|
48 (when (file-exists-p file) |
2522a70cd009
(custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents:
17685
diff
changeset
|
49 (erase-buffer) |
2522a70cd009
(custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents:
17685
diff
changeset
|
50 (insert-file-contents file) |
2522a70cd009
(custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents:
17685
diff
changeset
|
51 (goto-char (point-min)) |
2522a70cd009
(custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents:
17685
diff
changeset
|
52 (string-match "\\`\\(.*\\)\\.el\\'" file) |
2522a70cd009
(custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents:
17685
diff
changeset
|
53 (let ((name (file-name-nondirectory (match-string 1 file)))) |
2522a70cd009
(custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents:
17685
diff
changeset
|
54 (condition-case nil |
2522a70cd009
(custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents:
17685
diff
changeset
|
55 (while (re-search-forward "^(defcustom\\|^(defface\\|^(defgroup" |
2522a70cd009
(custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents:
17685
diff
changeset
|
56 nil t) |
2522a70cd009
(custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents:
17685
diff
changeset
|
57 (beginning-of-line) |
2522a70cd009
(custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents:
17685
diff
changeset
|
58 (let ((expr (read (current-buffer)))) |
2522a70cd009
(custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents:
17685
diff
changeset
|
59 (eval expr) |
2522a70cd009
(custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents:
17685
diff
changeset
|
60 (put (nth 1 expr) 'custom-where name))) |
2522a70cd009
(custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents:
17685
diff
changeset
|
61 (error nil))))) |
17685
3a1471ba9387
(custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents:
17520
diff
changeset
|
62 (setq all-subdirs (cdr all-subdirs))))) |
17393 | 63 (message "Generating cus-load.el...") |
64 (find-file "cus-load.el") | |
65 (erase-buffer) | |
66 (insert "\ | |
67 ;;; cus-load.el --- automatically extracted custom dependencies | |
68 ;; | |
69 ;;; Code: | |
17395 | 70 |
17393 | 71 ") |
72 (mapatoms (lambda (symbol) | |
73 (let ((members (get symbol 'custom-group)) | |
74 item where found) | |
75 (when members | |
76 (while members | |
77 (setq item (car (car members)) | |
78 members (cdr members) | |
79 where (get item 'custom-where)) | |
80 (unless (or (null where) | |
81 (member where found)) | |
82 (if found | |
83 (insert " ") | |
84 (insert "(put '" (symbol-name symbol) | |
85 " 'custom-loads '(")) | |
17473
83503d0dc576
Fixed generation of empty dependencies lists.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17395
diff
changeset
|
86 (prin1 where (current-buffer)) |
17393 | 87 (push where found))) |
17473
83503d0dc576
Fixed generation of empty dependencies lists.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17395
diff
changeset
|
88 (when found |
83503d0dc576
Fixed generation of empty dependencies lists.
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
17395
diff
changeset
|
89 (insert "))\n")))))) |
17479 | 90 (insert "\ |
91 | |
92 \(provide 'cus-load) | |
93 | |
94 ;;; cus-load.el ends here\n") | |
17685
3a1471ba9387
(custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents:
17520
diff
changeset
|
95 (let ((kept-new-versions 10000000)) |
3a1471ba9387
(custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents:
17520
diff
changeset
|
96 (save-buffer)) |
17744
2522a70cd009
(custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents:
17685
diff
changeset
|
97 (message "Generating cus-load.el...done") |
2522a70cd009
(custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents:
17685
diff
changeset
|
98 (kill-emacs)) |
17393 | 99 |
100 ;;; cus-dep.el ends here |