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