(gomoku-font-lock-O-face): Convert to use `defface'.
[emacs.git] / lisp / loadup.el
blob871d8eb19a7897833fcfbcaf5f7bbd921b506d58
1 ;;; loadup.el --- load up standardly loaded Lisp files for Emacs
3 ;; Copyright (C) 1985, 1986, 1992, 1994, 2001 Free Software Foundation, Inc.
5 ;; Maintainer: FSF
6 ;; Keywords: internal
8 ;; This file is part of GNU Emacs.
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.
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.
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.
25 ;;; Commentary:
27 ;; This is loaded into a bare Emacs to make a dumpable one.
29 ;;; Code:
31 ;; add subdirectories to the load-path for files that might
32 ;; get autoloaded when bootstrapping
33 (if (or (equal (nth 3 command-line-args) "bootstrap")
34 (equal (nth 4 command-line-args) "bootstrap")
35 ;; in case CANNOT_DUMP
36 (equal (nth 0 command-line-args) "../src/bootstrap-emacs"))
37 (let ((path (car load-path)))
38 (setq load-path (list path
39 (expand-file-name "emacs-lisp" path)
40 (expand-file-name "language" path)
41 (expand-file-name "international" path)))))
43 (message "Using load-path %s" load-path)
45 ;; We don't want to have any undo records in the dumped Emacs.
46 (buffer-disable-undo "*scratch*")
48 (load "byte-run")
49 (load "emacs-lisp/backquote")
50 (load "subr")
52 ;; We specify .el in case someone compiled version.el by mistake.
53 (load "version.el")
55 (load "widget")
56 (load "custom")
57 (load "map-ynp")
58 (load "env")
59 (load "cus-start")
60 (load "international/mule")
61 (load "international/mule-conf.el") ;Don't get confused if someone compiled this by mistake.
62 (load "format")
63 (load "bindings")
64 (setq load-source-file-function 'load-with-code-conversion)
65 (load "simple")
66 (load "files")
68 (load "faces") ; after here, `defface' may be used.
70 (message "Lists of integers (garbage collection statistics) are normal output")
71 (message "while building Emacs; they do not indicate a problem.")
72 (message "%s" (garbage-collect))
73 (load "loaddefs.el") ;Don't get confused if someone compiled this by mistake.
74 (message "%s" (garbage-collect))
76 (load "help")
78 ;; Any Emacs Lisp source file (*.el) loaded here after can contain
79 ;; multilingual text.
80 (load "international/mule-cmds")
81 (load "case-table")
82 (load "international/characters")
83 (load "international/utf-8")
85 (let ((set-case-syntax-set-multibyte t))
86 (load "international/latin-1")
87 (load "international/latin-2")
88 (load "international/latin-3")
89 (load "international/latin-4")
90 (load "international/latin-5")
91 (load "international/latin-8")
92 (load "international/latin-9"))
93 ;; Load language-specific files.
94 (load "language/chinese")
95 (load "language/cyrillic")
96 (load "language/indian")
97 (load "language/devanagari") ; This should be loaded after indian.
98 (load "language/english")
99 (load "language/ethiopic")
100 (load "language/european")
101 (load "language/czech")
102 (load "language/slovak")
103 (load "language/romanian")
104 (load "language/greek")
105 (load "language/hebrew")
106 (load "language/japanese")
107 (load "language/korean")
108 (load "language/lao")
109 (load "language/thai")
110 (load "language/tibetan")
111 (load "language/vietnamese")
112 (load "language/misc-lang")
113 (load "language/utf-8-lang")
114 (load "language/georgian")
116 (load "international/ucs-tables")
117 (unify-8859-on-encoding-mode 1)
119 (update-coding-systems-internal)
121 (load "indent")
122 (load "window")
123 (load "frame")
124 (load "term/tty-colors")
126 (if (fboundp 'frame-face-alist)
127 (progn
128 (load "facemenu")))
129 (if (fboundp 'track-mouse)
130 (progn
131 (load "mouse")
132 (and (boundp 'x-toolkit-scroll-bars)
133 (load "scroll-bar"))
134 (load "select")))
135 (load "isearch")
137 (message "%s" (garbage-collect))
138 (load "menu-bar")
139 (load "paths.el") ;Don't get confused if someone compiled paths by mistake.
140 (load "startup")
141 (load "emacs-lisp/lisp")
142 (load "textmodes/page")
143 (load "register")
144 (load "textmodes/paragraphs")
145 (load "emacs-lisp/lisp-mode")
146 (load "textmodes/text-mode")
147 (load "textmodes/fill")
148 (message "%s" (garbage-collect))
150 (load "replace")
151 (if (eq system-type 'vax-vms)
152 (progn
153 (load "vmsproc")))
154 (load "abbrev")
155 (load "buff-menu")
156 (if (eq system-type 'vax-vms)
157 (progn
158 (load "vms-patch")))
159 (if (eq system-type 'windows-nt)
160 (progn
161 (load "ls-lisp")
162 (load "disp-table") ; needed to setup ibm-pc char set, see internal.el
163 (load "dos-w32")
164 (load "w32-vars")
165 (load "w32-fns")))
166 (if (eq system-type 'ms-dos)
167 (progn
168 (load "ls-lisp")
169 (load "dos-w32")
170 (load "dos-fns")
171 (load "dos-vars")
172 (load "international/ccl") ; codepage.el uses CCL en/decoder
173 (load "international/codepage") ; internal.el uses cpNNN coding systems
174 (load "disp-table"))) ; needed to setup ibm-pc char set, see internal.el
175 (if (eq system-type 'macos)
176 (progn
177 (load "ls-lisp")))
178 (if (fboundp 'atan) ; preload some constants and
179 (progn ; floating pt. functions if we have float support.
180 (load "float-sup")))
181 (message "%s" (garbage-collect))
183 (load "vc-hooks")
184 (load "ediff-hook")
185 (message "%s" (garbage-collect))
187 ;If you want additional libraries to be preloaded and their
188 ;doc strings kept in the DOC file rather than in core,
189 ;you may load them with a "site-load.el" file.
190 ;But you must also cause them to be scanned when the DOC file
191 ;is generated. For VMS, you must edit ../vms/makedoc.com.
192 ;For other systems, you must edit ../src/Makefile.in.
193 (if (load "site-load" t)
194 (garbage-collect))
196 (if (fboundp 'x-popup-menu)
197 (precompute-menubar-bindings))
198 ;; Turn on recording of which commands get rebound,
199 ;; for the sake of the next call to precompute-menubar-bindings.
200 (setq define-key-rebound-commands nil)
202 ;; Determine which last version number to use
203 ;; based on the executables that now exist.
204 (if (and (or (equal (nth 3 command-line-args) "dump")
205 (equal (nth 4 command-line-args) "dump"))
206 (not (eq system-type 'ms-dos)))
207 (let* ((base (concat "emacs-" emacs-version "."))
208 (files (file-name-all-completions base default-directory))
209 (versions (mapcar (function (lambda (name)
210 (string-to-int (substring name (length base)))))
211 files)))
212 ;; `emacs-version' is a constant, so we shouldn't change it with `setq'.
213 (defconst emacs-version
214 (format "%s.%d"
215 emacs-version (if versions (1+ (apply 'max versions)) 1)))))
217 ;; Note: all compiled Lisp files loaded above this point
218 ;; must be among the ones parsed by make-docfile
219 ;; to construct DOC. Any that are not processed
220 ;; for DOC will not have doc strings in the dumped Emacs.
222 (message "Finding pointers to doc strings...")
223 (if (or (equal (nth 3 command-line-args) "dump")
224 (equal (nth 4 command-line-args) "dump"))
225 (let ((name emacs-version))
226 (while (string-match "[^-+_.a-zA-Z0-9]+" name)
227 (setq name (concat (downcase (substring name 0 (match-beginning 0)))
229 (substring name (match-end 0)))))
230 (if (memq system-type '(ms-dos windows-nt))
231 (setq name (expand-file-name
232 (if (fboundp 'x-create-frame) "DOC-X" "DOC") "../etc"))
233 (setq name (concat (expand-file-name "../etc/DOC-") name))
234 (if (file-exists-p name)
235 (delete-file name))
236 (copy-file (expand-file-name "../etc/DOC") name t))
237 (Snarf-documentation (file-name-nondirectory name)))
238 (condition-case nil
239 (Snarf-documentation "DOC")
240 (error nil)))
241 (message "Finding pointers to doc strings...done")
243 ;;;Note: You can cause additional libraries to be preloaded
244 ;;;by writing a site-init.el that loads them.
245 ;;;See also "site-load" above.
246 (load "site-init" t)
247 (setq current-load-list nil)
249 ;; Write the value of load-history into fns-VERSION.el,
250 ;; then clear out load-history.
251 (if (or (equal (nth 3 command-line-args) "dump")
252 (equal (nth 4 command-line-args) "dump"))
253 (let ((buffer-undo-list t))
254 (princ "(setq load-history\n" (current-buffer))
255 (princ " (nconc load-history\n" (current-buffer))
256 (princ " '(" (current-buffer))
257 (let ((tem load-history))
258 (while tem
259 (prin1 (car tem) (current-buffer))
260 (terpri (current-buffer))
261 (if (cdr tem)
262 (princ " " (current-buffer)))
263 (setq tem (cdr tem))))
264 (princ ")))\n" (current-buffer))
265 (write-region (point-min) (point-max)
266 (expand-file-name
267 (cond
268 ((eq system-type 'ms-dos)
269 "../lib-src/fns.el")
270 ((eq system-type 'windows-nt)
271 (format "../../../lib-src/fns-%s.el" emacs-version))
273 (format "../lib-src/fns-%s.el" emacs-version)))
274 invocation-directory))
275 (erase-buffer)
276 (setq load-history nil))
277 (setq symbol-file-load-history-loaded t))
278 (set-buffer-modified-p nil)
280 ;; reset the load-path. See lread.c:init_lread why.
281 (if (or (equal (nth 3 command-line-args) "bootstrap")
282 (equal (nth 4 command-line-args) "bootstrap"))
283 (setcdr load-path nil))
285 (garbage-collect)
287 ;;; At this point, we're ready to resume undo recording for scratch.
288 (buffer-enable-undo "*scratch*")
290 (if (or (member (nth 3 command-line-args) '("dump" "bootstrap"))
291 (member (nth 4 command-line-args) '("dump" "bootstrap")))
292 (if (eq system-type 'vax-vms)
293 (progn
294 (message "Dumping data as file temacs.dump")
295 (dump-emacs "temacs.dump" "temacs")
296 (kill-emacs))
297 (let ((name (concat "emacs-" emacs-version)))
298 (while (string-match "[^-+_.a-zA-Z0-9]+" name)
299 (setq name (concat (downcase (substring name 0 (match-beginning 0)))
301 (substring name (match-end 0)))))
302 (if (eq system-type 'ms-dos)
303 (message "Dumping under the name emacs")
304 (message "Dumping under names emacs and %s" name)))
305 (condition-case ()
306 (delete-file "emacs")
307 (file-error nil))
308 ;; We used to dump under the name xemacs, but that occasionally
309 ;; confused people installing Emacs (they'd install the file
310 ;; under the name `xemacs'), and it's inconsistent with every
311 ;; other GNU program's build process.
312 (dump-emacs "emacs" "temacs")
313 (message "%d pure bytes used" pure-bytes-used)
314 ;; Recompute NAME now, so that it isn't set when we dump.
315 (if (not (memq system-type '(ms-dos windows-nt)))
316 (let ((name (concat "emacs-" emacs-version)))
317 (while (string-match "[^-+_.a-zA-Z0-9]+" name)
318 (setq name (concat (downcase (substring name 0 (match-beginning 0)))
320 (substring name (match-end 0)))))
321 (add-name-to-file "emacs" name t)))
322 (kill-emacs)))
324 ;; Avoid error if user loads some more libraries now.
325 (setq purify-flag nil)
327 ;; For machines with CANNOT_DUMP defined in config.h,
328 ;; this file must be loaded each time Emacs is run.
329 ;; So run the startup code now. First, remove `-l loadup' from args.
331 (if (and (equal (nth 1 command-line-args) "-l")
332 (equal (nth 2 command-line-args) "loadup"))
333 (setcdr command-line-args (nthcdr 3 command-line-args)))
335 (eval top-level)
338 ;;; Local Variables:
339 ;;; no-byte-compile: t
340 ;;; no-update-autoloads: t
341 ;;; End:
342 ;;; loadup.el ends here