1 ;;; loadup.el --- load up standardly loaded Lisp files for Emacs
3 ;; Copyright (C) 1985, 1986, 1992, 1994, 2001 Free Software Foundation, Inc.
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)
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.
27 ;; This is loaded into a bare Emacs to make a dumpable one.
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")
55 ;; We specify .el in case someone compiled version.el by mistake.
60 (load "emacs-lisp/map-ynp")
63 (load "international/mule")
64 (load "international/mule-conf.el") ;Don't get confused if someone compiled this by mistake.
67 (setq load-source-file-function
'load-with-code-conversion
)
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))
82 ;; Any Emacs Lisp source file (*.el) loaded here after can contain
84 (load "international/mule-cmds")
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/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/thai")
117 (load "language/tibetan")
118 (load "language/vietnamese")
119 (load "language/misc-lang")
120 (load "language/utf-8-lang")
121 (load "language/georgian")
123 (load "international/ucs-tables")
125 (update-coding-systems-internal)
130 (load "term/tty-colors")
133 (if (fboundp 'frame-face-alist
)
136 (if (fboundp 'track-mouse
)
139 (and (boundp 'x-toolkit-scroll-bars
)
142 (load "emacs-lisp/timer")
145 (message "%s" (garbage-collect))
147 (load "paths.el") ;Don't get confused if someone compiled paths by mistake.
149 (load "emacs-lisp/lisp")
150 (load "textmodes/page")
152 (load "textmodes/paragraphs")
153 (load "emacs-lisp/lisp-mode")
154 (load "textmodes/text-mode")
155 (load "textmodes/fill")
156 (message "%s" (garbage-collect))
159 (if (eq system-type
'vax-vms
)
164 (if (eq system-type
'vax-vms
)
167 (if (eq system-type
'windows-nt
)
170 (load "disp-table") ; needed to setup ibm-pc char set, see internal.el
174 (if (eq system-type
'ms-dos
)
180 (load "international/ccl") ; codepage.el uses CCL en/decoder
181 (load "international/codepage") ; internal.el uses cpNNN coding systems
182 (load "disp-table"))) ; needed to setup ibm-pc char set, see internal.el
183 (if (eq system-type
'macos
)
186 (if (fboundp 'atan
) ; preload some constants and
187 (progn ; floating pt. functions if we have float support.
188 (load "emacs-lisp/float-sup")))
189 (message "%s" (garbage-collect))
193 (message "%s" (garbage-collect))
195 ;If you want additional libraries to be preloaded and their
196 ;doc strings kept in the DOC file rather than in core,
197 ;you may load them with a "site-load.el" file.
198 ;But you must also cause them to be scanned when the DOC file
199 ;is generated. For VMS, you must edit ../vms/makedoc.com.
200 ;For other systems, you must edit ../src/Makefile.in.
201 (if (load "site-load" t
)
204 (if (fboundp 'x-popup-menu
)
205 (precompute-menubar-bindings))
206 ;; Turn on recording of which commands get rebound,
207 ;; for the sake of the next call to precompute-menubar-bindings.
208 (setq define-key-rebound-commands nil
)
210 ;; Determine which last version number to use
211 ;; based on the executables that now exist.
212 (if (and (or (equal (nth 3 command-line-args
) "dump")
213 (equal (nth 4 command-line-args
) "dump"))
214 (not (eq system-type
'ms-dos
)))
215 (let* ((base (concat "emacs-" emacs-version
"."))
216 (files (file-name-all-completions base default-directory
))
217 (versions (mapcar (function (lambda (name)
218 (string-to-int (substring name
(length base
)))))
220 ;; `emacs-version' is a constant, so we shouldn't change it with `setq'.
221 (defconst emacs-version
223 emacs-version
(if versions
(1+ (apply 'max versions
)) 1)))))
225 ;; Note: all compiled Lisp files loaded above this point
226 ;; must be among the ones parsed by make-docfile
227 ;; to construct DOC. Any that are not processed
228 ;; for DOC will not have doc strings in the dumped Emacs.
230 (message "Finding pointers to doc strings...")
231 (if (or (equal (nth 3 command-line-args
) "dump")
232 (equal (nth 4 command-line-args
) "dump"))
233 (let ((name emacs-version
))
234 (while (string-match "[^-+_.a-zA-Z0-9]+" name
)
235 (setq name
(concat (downcase (substring name
0 (match-beginning 0)))
237 (substring name
(match-end 0)))))
238 (if (memq system-type
'(ms-dos windows-nt
))
239 (setq name
(expand-file-name
240 (if (fboundp 'x-create-frame
) "DOC-X" "DOC") "../etc"))
241 (setq name
(concat (expand-file-name "../etc/DOC-") name
))
242 (if (file-exists-p name
)
244 (copy-file (expand-file-name "../etc/DOC") name t
))
245 (Snarf-documentation (file-name-nondirectory name
)))
247 (Snarf-documentation "DOC")
249 (message "Finding pointers to doc strings...done")
251 ;;;Note: You can cause additional libraries to be preloaded
252 ;;;by writing a site-init.el that loads them.
253 ;;;See also "site-load" above.
255 (setq current-load-list nil
)
257 ;; Write the value of load-history into fns-VERSION.el,
258 ;; then clear out load-history.
259 ;; (if (or (equal (nth 3 command-line-args) "dump")
260 ;; (equal (nth 4 command-line-args) "dump"))
261 ;; (let ((buffer-undo-list t))
262 ;; (princ "(setq load-history\n" (current-buffer))
263 ;; (princ " (nconc load-history\n" (current-buffer))
264 ;; (princ " '(" (current-buffer))
265 ;; (let ((tem load-history))
267 ;; (prin1 (car tem) (current-buffer))
268 ;; (terpri (current-buffer))
270 ;; (princ " " (current-buffer)))
271 ;; (setq tem (cdr tem))))
272 ;; (princ ")))\n" (current-buffer))
273 ;; (write-region (point-min) (point-max)
276 ;; ((eq system-type 'ms-dos)
277 ;; "../lib-src/fns.el")
278 ;; ((eq system-type 'windows-nt)
279 ;; (format "../../../lib-src/fns-%s.el" emacs-version))
281 ;; (format "../lib-src/fns-%s.el" emacs-version)))
282 ;; invocation-directory))
284 ;; (setq load-history nil))
285 ;; (setq symbol-file-load-history-loaded t))
286 ;; We don't use this fns-*.el file. Instead we keep the data in PURE space.
287 ;; Make sure that the spine of the list is not in pure space because it can
288 ;; be destructively mutated in lread.c:build_load_history.
289 (setq load-history
(mapcar 'purecopy load-history
))
290 (setq symbol-file-load-history-loaded t
)
292 (set-buffer-modified-p nil
)
294 ;; reset the load-path. See lread.c:init_lread why.
295 (if (or (equal (nth 3 command-line-args
) "bootstrap")
296 (equal (nth 4 command-line-args
) "bootstrap"))
297 (setcdr load-path nil
))
301 ;;; At this point, we're ready to resume undo recording for scratch.
302 (buffer-enable-undo "*scratch*")
304 (if (or (member (nth 3 command-line-args
) '("dump" "bootstrap"))
305 (member (nth 4 command-line-args
) '("dump" "bootstrap")))
306 (if (eq system-type
'vax-vms
)
308 (message "Dumping data as file temacs.dump")
309 (dump-emacs "temacs.dump" "temacs")
311 (let ((name (concat "emacs-" emacs-version
)))
312 (while (string-match "[^-+_.a-zA-Z0-9]+" name
)
313 (setq name
(concat (downcase (substring name
0 (match-beginning 0)))
315 (substring name
(match-end 0)))))
316 (if (eq system-type
'ms-dos
)
317 (message "Dumping under the name emacs")
318 (message "Dumping under names emacs and %s" name
)))
320 (delete-file "emacs")
322 ;; We used to dump under the name xemacs, but that occasionally
323 ;; confused people installing Emacs (they'd install the file
324 ;; under the name `xemacs'), and it's inconsistent with every
325 ;; other GNU program's build process.
326 (dump-emacs "emacs" "temacs")
327 (message "%d pure bytes used" pure-bytes-used
)
328 ;; Recompute NAME now, so that it isn't set when we dump.
329 (if (not (memq system-type
'(ms-dos windows-nt
)))
330 (let ((name (concat "emacs-" emacs-version
)))
331 (while (string-match "[^-+_.a-zA-Z0-9]+" name
)
332 (setq name
(concat (downcase (substring name
0 (match-beginning 0)))
334 (substring name
(match-end 0)))))
335 (add-name-to-file "emacs" name t
)))
338 ;; Avoid error if user loads some more libraries now.
339 (setq purify-flag nil
)
341 ;; For machines with CANNOT_DUMP defined in config.h,
342 ;; this file must be loaded each time Emacs is run.
343 ;; So run the startup code now. First, remove `-l loadup' from args.
345 (if (and (equal (nth 1 command-line-args
) "-l")
346 (equal (nth 2 command-line-args
) "loadup"))
347 (setcdr command-line-args
(nthcdr 3 command-line-args
)))
353 ;;; no-byte-compile: t
354 ;;; no-update-autoloads: t
356 ;;; loadup.el ends here