annotate lisp/cus-dep.el @ 17692:426dde653028 gnumach-release-1-1 gnumach-release-1-1-1 libc-970508 libc-970509 libc-970510 libc-970511 libc-970512 libc-970513 libc-970514 libc-970515 libc-970516 libc-970517 libc-970518 libc-970519 libc-970520 libc-970521 libc-970522 libc-970523 libc-970524 libc-970525 libc-970526 libc-970527 libc-970528 libc-970529 libc-970530 libc-970531 libc-970601 libc-970602 libc-970603 libc-970604 libc-970605

Recognize either / or - as a machine/suptype separator from uname -m to cope with older systems that have the older uname.
author Thomas Bushnell, BSG <thomas@gnu.org>
date Wed, 07 May 1997 19:19:04 +0000
parents 3a1471ba9387
children 2522a70cd009
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.
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
33 Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies"
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
34 (let ((enable-local-eval nil)
17685
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
35 all-subdirs pending
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 (setq pending '("."))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
40 (while pending
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
41 (let ((this (car pending))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
42 this-subdirs
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
43 default-directory)
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
44 (setq all-subdirs (cons this all-subdirs))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
45 (setq pending (cdr pending))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
46 (setq default-directory
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
47 (expand-file-name this start-directory))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
48 (message "Finding subdirs of %s" this)
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
49 (erase-buffer)
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
50 (condition-case nil
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
51 (progn
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
52 (insert-file-contents "subdirs.el")
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
53 (goto-char (point-min))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
54 (search-forward "'(")
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
55 (forward-char -1)
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
56 (setq this-subdirs (read (current-buffer)))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
57 (setq pending (nconc pending
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
58 (mapcar
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
59 (function (lambda (dir)
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
60 (file-relative-name
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
61 (file-name-as-directory
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
62 (expand-file-name dir this))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
63 start-directory)))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
64 this-subdirs))))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
65 (error nil))))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
66
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
67 (while all-subdirs
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
68 (message "Directory %s" (car all-subdirs))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
69 (let ((files (directory-files (car all-subdirs) nil "\\`[^=].*\\.el\\'"))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
70 (default-directory default-directory)
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
71 file)
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
72 (cd (car all-subdirs))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
73 (while files
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
74 (setq file (car files)
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
75 files (cdr files))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
76 (message "Checking %s..." file)
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
77 (erase-buffer)
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
78 (insert-file-contents file)
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
79 (goto-char (point-min))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
80 (string-match "\\`\\(.*\\)\\.el\\'" file)
17393
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
81 (let ((name (file-name-nondirectory (match-string 1 file))))
17685
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
82 (condition-case nil
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
83 (while (re-search-forward "^(defcustom\\|^(defface\\|^(defgroup"
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
84 nil t)
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
85 (beginning-of-line)
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
86 (let ((expr (read (current-buffer))))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
87 (eval expr)
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
88 (put (nth 1 expr) 'custom-where name)))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
89 (error nil))))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
90 (setq all-subdirs (cdr all-subdirs)))))
17393
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
91 (message "Generating cus-load.el...")
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
92 (find-file "cus-load.el")
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
93 (erase-buffer)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
94 (insert "\
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
95 ;;; cus-load.el --- automatically extracted custom dependencies
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
96 ;;
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
97 ;;; Code:
17395
ad9d92edda0d Added newline.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17393
diff changeset
98
17393
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
99 ")
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
100 (mapatoms (lambda (symbol)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
101 (let ((members (get symbol 'custom-group))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
102 item where found)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
103 (when members
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
104 (while members
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
105 (setq item (car (car members))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
106 members (cdr members)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
107 where (get item 'custom-where))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
108 (unless (or (null where)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
109 (member where found))
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
110 (if found
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
111 (insert " ")
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
112 (insert "(put '" (symbol-name symbol)
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
113 " 'custom-loads '("))
17473
83503d0dc576 Fixed generation of empty dependencies lists.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17395
diff changeset
114 (prin1 where (current-buffer))
17393
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
115 (push where found)))
17473
83503d0dc576 Fixed generation of empty dependencies lists.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17395
diff changeset
116 (when found
83503d0dc576 Fixed generation of empty dependencies lists.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17395
diff changeset
117 (insert "))\n"))))))
17479
b613ee4fd988 provide `cus-load'.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17474
diff changeset
118 (insert "\
b613ee4fd988 provide `cus-load'.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17474
diff changeset
119
b613ee4fd988 provide `cus-load'.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17474
diff changeset
120 \(provide 'cus-load)
b613ee4fd988 provide `cus-load'.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17474
diff changeset
121
b613ee4fd988 provide `cus-load'.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17474
diff changeset
122 ;;; cus-load.el ends here\n")
17685
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
123 (let ((kept-new-versions 10000000))
3a1471ba9387 (custom-make-dependencies):
Richard M. Stallman <rms@gnu.org>
parents: 17520
diff changeset
124 (save-buffer))
17474
90cfef3930bc Fixed message.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 17473
diff changeset
125 (message "Generating cus-load.el...done"))
17393
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
126
14c7f7b87c22 Initial revision
Per Abrahamsen <abraham@dina.kvl.dk>
parents:
diff changeset
127 ;;; cus-dep.el ends here