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