1 ;;; loadup.el --- load up standardly loaded Lisp files for Emacs
3 ;; Copyright (C) 1985, 1986, 1992, 1994, 2001, 2002, 2003,
4 ;; 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
28 ;; This is loaded into a bare Emacs to make a dumpable one.
32 ;; add subdirectories to the load-path for files that might
33 ;; get autoloaded when bootstrapping
34 (if (or (equal (nth 3 command-line-args
) "bootstrap")
35 (equal (nth 4 command-line-args
) "bootstrap")
36 (equal (nth 3 command-line-args
) "unidata-gen.el")
37 (equal (nth 4 command-line-args
) "unidata-gen-files")
38 ;; in case CANNOT_DUMP
39 (equal (nth 0 command-line-args
) "../src/bootstrap-emacs"))
40 (let ((dir (car load-path
)))
41 ;; We'll probably overflow the pure space.
42 (setq purify-flag nil
)
43 (setq load-path
(list dir
44 (expand-file-name "emacs-lisp" dir
)
45 (expand-file-name "language" dir
)
46 (expand-file-name "international" dir
)
47 (expand-file-name "textmodes" dir
)))))
49 (message "Using load-path %s" load-path
)
51 ;; We don't want to have any undo records in the dumped Emacs.
52 (set-buffer "*scratch*")
53 (setq buffer-undo-list t
)
55 (load "emacs-lisp/byte-run")
56 (load "emacs-lisp/backquote")
59 ;; We specify .el in case someone compiled version.el by mistake.
64 (load "emacs-lisp/map-ynp")
67 (load "international/mule")
68 (load "international/mule-conf.el") ;Don't get confused if someone compiled this by mistake.
71 (setq load-source-file-function
'load-with-code-conversion
)
75 (load "faces") ; after here, `defface' may be used.
77 (message "Lists of integers (garbage collection statistics) are normal output")
78 (message "while building Emacs; they do not indicate a problem.")
79 (message "%s" (garbage-collect))
80 (load "loaddefs.el") ;Don't get confused if someone compiled this by mistake.
81 (message "%s" (garbage-collect))
86 (load "jka-cmpr-hook")
87 ;; Any Emacs Lisp source file (*.el) loaded here after can contain
89 (load "international/mule-cmds")
91 (load "international/characters")
93 ;; This file doesn't exist when building Emacs from CVS. It is
94 ;; generated just after temacs is build.
95 (load "international/charprop.el" t
)
97 ;; Load language-specific files.
98 (load "language/chinese")
99 (load "language/cyrillic")
100 (load "language/indian")
101 (load "language/devanagari") ; This should be loaded after indian.
102 (load "language/malayalam") ; This should be loaded after indian.
103 (load "language/tamil") ; This should be loaded after indian.
104 (load "language/kannada") ; This should be loaded after indian.
105 (load "language/english")
106 (load "language/ethiopic")
107 (load "language/european")
108 (load "language/czech")
109 (load "language/slovak")
110 (load "language/romanian")
111 (load "language/greek")
112 (load "language/hebrew")
113 (load "language/japanese")
114 (load "language/korean")
115 (load "language/lao")
116 (load "language/tai-viet")
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")
127 (load "term/tty-colors")
129 ;; facemenu must be loaded before font-lock, because `facemenu-keymap'
130 ;; needs to be defined when font-lock is loaded.
132 (load "emacs-lisp/syntax")
136 (if (fboundp 'track-mouse
)
139 (and (boundp 'x-toolkit-scroll-bars
)
142 (load "emacs-lisp/timer")
146 (message "%s" (garbage-collect))
148 (load "paths.el") ;Don't get confused if someone compiled paths by mistake.
150 (load "emacs-lisp/lisp")
151 (load "textmodes/page")
153 (load "textmodes/paragraphs")
154 (load "emacs-lisp/lisp-mode")
155 (load "textmodes/text-mode")
156 (load "textmodes/fill")
157 (message "%s" (garbage-collect))
160 (if (eq system-type
'vax-vms
)
166 (if (fboundp 'x-create-frame
)
170 (load "international/fontset")
176 (message "%s" (garbage-collect))
178 (if (eq system-type
'vax-vms
)
181 (if (eq system-type
'windows-nt
)
184 (load "disp-table") ; needed to setup ibm-pc char set, see internal.el
188 (if (eq system-type
'ms-dos
)
194 (load "international/ccl") ; codepage.el uses CCL en/decoder
195 (load "international/codepage") ; internal.el uses cpNNN coding systems
196 (load "disp-table"))) ; needed to setup ibm-pc char set, see internal.el
197 (if (eq system-type
'macos
)
200 (if (fboundp 'atan
) ; preload some constants and
201 (progn ; floating pt. functions if we have float support.
202 (load "emacs-lisp/float-sup")))
203 (message "%s" (garbage-collect))
207 (if (fboundp 'x-show-tip
) (load "tooltip"))
209 (message "%s" (garbage-collect))
211 ;If you want additional libraries to be preloaded and their
212 ;doc strings kept in the DOC file rather than in core,
213 ;you may load them with a "site-load.el" file.
214 ;But you must also cause them to be scanned when the DOC file
215 ;is generated. For VMS, you must edit ../vms/makedoc.com.
216 ;For other systems, you must edit ../src/Makefile.in.
217 (if (load "site-load" t
)
220 (if (fboundp 'x-popup-menu
)
221 (precompute-menubar-bindings))
222 ;; Turn on recording of which commands get rebound,
223 ;; for the sake of the next call to precompute-menubar-bindings.
224 (setq define-key-rebound-commands nil
)
226 ;; Determine which last version number to use
227 ;; based on the executables that now exist.
228 (if (and (or (equal (nth 3 command-line-args
) "dump")
229 (equal (nth 4 command-line-args
) "dump"))
230 (not (eq system-type
'ms-dos
)))
231 (let* ((base (concat "emacs-" emacs-version
"."))
232 (files (file-name-all-completions base default-directory
))
233 (versions (mapcar (function (lambda (name)
234 (string-to-int (substring name
(length base
)))))
236 ;; `emacs-version' is a constant, so we shouldn't change it with `setq'.
237 (defconst emacs-version
239 emacs-version
(if versions
(1+ (apply 'max versions
)) 1)))))
241 ;; Note: all compiled Lisp files loaded above this point
242 ;; must be among the ones parsed by make-docfile
243 ;; to construct DOC. Any that are not processed
244 ;; for DOC will not have doc strings in the dumped Emacs.
246 (message "Finding pointers to doc strings...")
247 (if (or (equal (nth 3 command-line-args
) "dump")
248 (equal (nth 4 command-line-args
) "dump"))
249 (let ((name emacs-version
))
250 (while (string-match "[^-+_.a-zA-Z0-9]+" name
)
251 (setq name
(concat (downcase (substring name
0 (match-beginning 0)))
253 (substring name
(match-end 0)))))
254 (if (memq system-type
'(ms-dos windows-nt
))
255 (setq name
(expand-file-name
256 (if (fboundp 'x-create-frame
) "DOC-X" "DOC") "../etc"))
257 (setq name
(concat (expand-file-name "../etc/DOC-") name
))
258 (if (file-exists-p name
)
260 (copy-file (expand-file-name "../etc/DOC") name t
))
261 (Snarf-documentation (file-name-nondirectory name
)))
263 (Snarf-documentation "DOC")
265 (message "Finding pointers to doc strings...done")
267 ;;;Note: You can cause additional libraries to be preloaded
268 ;;;by writing a site-init.el that loads them.
269 ;;;See also "site-load" above.
271 (setq current-load-list nil
)
273 ;; Write the value of load-history into fns-VERSION.el,
274 ;; then clear out load-history.
275 ;; (if (or (equal (nth 3 command-line-args) "dump")
276 ;; (equal (nth 4 command-line-args) "dump"))
277 ;; (let ((buffer-undo-list t))
278 ;; (princ "(setq load-history\n" (current-buffer))
279 ;; (princ " (nconc load-history\n" (current-buffer))
280 ;; (princ " '(" (current-buffer))
281 ;; (let ((tem load-history))
283 ;; (prin1 (car tem) (current-buffer))
284 ;; (terpri (current-buffer))
286 ;; (princ " " (current-buffer)))
287 ;; (setq tem (cdr tem))))
288 ;; (princ ")))\n" (current-buffer))
289 ;; (write-region (point-min) (point-max)
292 ;; ((eq system-type 'ms-dos)
293 ;; "../lib-src/fns.el")
294 ;; ((eq system-type 'windows-nt)
295 ;; (format "../../../lib-src/fns-%s.el" emacs-version))
297 ;; (format "../lib-src/fns-%s.el" emacs-version)))
298 ;; invocation-directory))
300 ;; (setq load-history nil))
301 ;; (setq symbol-file-load-history-loaded t))
302 ;; We don't use this fns-*.el file. Instead we keep the data in PURE space.
303 ;; Make sure that the spine of the list is not in pure space because it can
304 ;; be destructively mutated in lread.c:build_load_history.
305 (setq load-history
(mapcar 'purecopy load-history
))
306 (setq symbol-file-load-history-loaded t
)
308 (set-buffer-modified-p nil
)
310 ;; reset the load-path. See lread.c:init_lread why.
311 (if (or (equal (nth 3 command-line-args
) "bootstrap")
312 (equal (nth 4 command-line-args
) "bootstrap"))
313 (setcdr load-path nil
))
318 ;;; At this point, we're ready to resume undo recording for scratch.
319 (buffer-enable-undo "*scratch*")
321 (if (null (garbage-collect))
322 (setq pure-space-overflow t
))
324 (if (or (member (nth 3 command-line-args
) '("dump" "bootstrap"))
325 (member (nth 4 command-line-args
) '("dump" "bootstrap")))
326 (if (eq system-type
'vax-vms
)
328 (message "Dumping data as file temacs.dump")
329 (dump-emacs "temacs.dump" "temacs")
331 (let ((name (concat "emacs-" emacs-version
)))
332 (while (string-match "[^-+_.a-zA-Z0-9]+" name
)
333 (setq name
(concat (downcase (substring name
0 (match-beginning 0)))
335 (substring name
(match-end 0)))))
336 (if (memq system-type
'(ms-dos windows-nt cygwin
))
337 (message "Dumping under the name emacs")
338 (message "Dumping under names emacs and %s" name
)))
340 (delete-file "emacs")
342 ;; We used to dump under the name xemacs, but that occasionally
343 ;; confused people installing Emacs (they'd install the file
344 ;; under the name `xemacs'), and it's inconsistent with every
345 ;; other GNU program's build process.
346 (dump-emacs "emacs" "temacs")
347 (message "%d pure bytes used" pure-bytes-used
)
348 ;; Recompute NAME now, so that it isn't set when we dump.
349 (if (not (memq system-type
'(ms-dos windows-nt cygwin
)))
350 (let ((name (concat "emacs-" emacs-version
)))
351 (while (string-match "[^-+_.a-zA-Z0-9]+" name
)
352 (setq name
(concat (downcase (substring name
0 (match-beginning 0)))
354 (substring name
(match-end 0)))))
355 (add-name-to-file "emacs" name t
)))
358 ;; Avoid error if user loads some more libraries now.
359 (setq purify-flag nil
)
361 ;; For machines with CANNOT_DUMP defined in config.h,
362 ;; this file must be loaded each time Emacs is run.
363 ;; So run the startup code now. First, remove `-l loadup' from args.
365 (if (and (equal (nth 1 command-line-args
) "-l")
366 (equal (nth 2 command-line-args
) "loadup"))
367 (setcdr command-line-args
(nthcdr 3 command-line-args
)))
373 ;;; no-byte-compile: t
374 ;;; no-update-autoloads: t
377 ;;; arch-tag: 121e1dd4-36e1-45ac-860e-239f577a6335
378 ;;; loadup.el ends here