annotate lisp/cus-dep.el @ 18861:ed1871a409c8

(Finsert_file_contents) [DOS_NT]: Use the coding system to determine buffer_file_type. (Fwrite_region): Only use Qbuffer_file_coding_system before checking file-coding-system-alist if non-nil. (Fwrite_region) [DOS_NT]: Delete conditional code.
author Richard M. Stallman <rms@gnu.org>
date Fri, 18 Jul 1997 22:56:16 +0000
parents 2522a70cd009
children bbad6a02f725
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17393
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
1 ;;; cus-dep.el --- Find customization dependencies.
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
2 ;;
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
4 ;;
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
6 ;; Keywords: internal
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
7
17520
f33d7729b6a1 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17479
diff changeset
8 ;; This file is part of GNU Emacs.
f33d7729b6a1 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17479
diff changeset
9
f33d7729b6a1 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17479
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
f33d7729b6a1 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17479
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
f33d7729b6a1 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17479
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
f33d7729b6a1 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17479
diff changeset
13 ;; any later version.
f33d7729b6a1 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17479
diff changeset
14
f33d7729b6a1 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17479
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
f33d7729b6a1 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17479
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
f33d7729b6a1 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17479
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f33d7729b6a1 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17479
diff changeset
18 ;; GNU General Public License for more details.
f33d7729b6a1 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17479
diff changeset
19
f33d7729b6a1 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17479
diff changeset
20 ;; You should have received a copy of the GNU General Public License
f33d7729b6a1 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17479
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
f33d7729b6a1 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17479
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
f33d7729b6a1 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17479
diff changeset
23 ;; Boston, MA 02111-1307, USA.
f33d7729b6a1 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17479
diff changeset
24
17393
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
25 ;;; Code:
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
26
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
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
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
30
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
31 (defun custom-make-dependencies ()
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
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
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
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 (message "Checking %s..." file)
2522a70cd009 (custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents: 17685
diff changeset
50 (erase-buffer)
2522a70cd009 (custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents: 17685
diff changeset
51 (insert-file-contents file)
2522a70cd009 (custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents: 17685
diff changeset
52 (goto-char (point-min))
2522a70cd009 (custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents: 17685
diff changeset
53 (string-match "\\`\\(.*\\)\\.el\\'" file)
2522a70cd009 (custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents: 17685
diff changeset
54 (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
55 (condition-case nil
2522a70cd009 (custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents: 17685
diff changeset
56 (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
57 nil t)
2522a70cd009 (custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents: 17685
diff changeset
58 (beginning-of-line)
2522a70cd009 (custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents: 17685
diff changeset
59 (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
60 (eval expr)
2522a70cd009 (custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents: 17685
diff changeset
61 (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
62 (error nil)))))
17685
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
63 (setq all-subdirs (cdr all-subdirs)))))
17393
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
64 (message "Generating cus-load.el...")
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
65 (find-file "cus-load.el")
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
66 (erase-buffer)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
67 (insert "\
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
68 ;;; cus-load.el --- automatically extracted custom dependencies
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
69 ;;
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
70 ;;; Code:
17395
ad9d92edda0d Added newline.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17393
diff changeset
71
17393
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
72 ")
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
73 (mapatoms (lambda (symbol)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
74 (let ((members (get symbol 'custom-group))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
75 item where found)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
76 (when members
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
77 (while members
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
78 (setq item (car (car members))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
79 members (cdr members)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
80 where (get item 'custom-where))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
81 (unless (or (null where)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
82 (member where found))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
83 (if found
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
84 (insert " ")
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
85 (insert "(put '" (symbol-name symbol)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
86 " 'custom-loads '("))
17473
83503d0dc576 Fixed generation of empty dependencies lists.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17395
diff changeset
87 (prin1 where (current-buffer))
17393
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
88 (push where found)))
17473
83503d0dc576 Fixed generation of empty dependencies lists.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17395
diff changeset
89 (when found
83503d0dc576 Fixed generation of empty dependencies lists.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17395
diff changeset
90 (insert "))\n"))))))
17479
b613ee4fd988 provide `cus-load'.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17474
diff changeset
91 (insert "\
b613ee4fd988 provide `cus-load'.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17474
diff changeset
92
b613ee4fd988 provide `cus-load'.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17474
diff changeset
93 \(provide 'cus-load)
b613ee4fd988 provide `cus-load'.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17474
diff changeset
94
b613ee4fd988 provide `cus-load'.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17474
diff changeset
95 ;;; cus-load.el ends here\n")
17685
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
96 (let ((kept-new-versions 10000000))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
97 (save-buffer))
17744
2522a70cd009 (custom-make-dependencies): Don't find the subdirs here;
Richard M. Stallman <rms@gnu.org>
parents: 17685
diff changeset
98 (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
99 (kill-emacs))
17393
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
100
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
101 ;;; cus-dep.el ends here