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