]> code.delx.au - gnu-emacs/blob - lisp/loadup.el
Don't say we are dumping under 2 names on windows-nt and cygwin.
[gnu-emacs] / lisp / loadup.el
1 ;;; loadup.el --- load up standardly loaded Lisp files for Emacs
2
3 ;; Copyright (C) 1985, 1986, 1992, 1994, 2001 Free Software Foundation, Inc.
4
5 ;; Maintainer: FSF
6 ;; Keywords: internal
7
8 ;; This file is part of GNU Emacs.
9
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.
14
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.
19
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.
24
25 ;;; Commentary:
26
27 ;; This is loaded into a bare Emacs to make a dumpable one.
28
29 ;;; Code:
30
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)))))
45
46 (message "Using load-path %s" load-path)
47
48 ;; We don't want to have any undo records in the dumped Emacs.
49 (set-buffer "*scratch*")
50 (setq buffer-undo-list t)
51
52 (load "emacs-lisp/byte-run")
53 (load "emacs-lisp/backquote")
54 (load "subr")
55
56 ;; We specify .el in case someone compiled version.el by mistake.
57 (load "version.el")
58
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")
70
71 (load "cus-face")
72 (load "faces") ; after here, `defface' may be used.
73
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")
80
81 (load "help")
82
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")
90
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")
124
125 (load "international/ucs-tables")
126
127 (update-coding-systems-internal)
128
129 (load "indent")
130 (load "window")
131 (load "frame")
132 (load "term/tty-colors")
133 (load "font-core")
134
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")
146
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))
159
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))
192
193 (load "vc-hooks")
194 (load "jka-cmpr-hook")
195 (load "ediff-hook")
196 (if (fboundp 'x-show-tip) (load "tooltip"))
197 (message "%s" (garbage-collect))
198
199 ;If you want additional libraries to be preloaded and their
200 ;doc strings kept in the DOC file rather than in core,
201 ;you may load them with a "site-load.el" file.
202 ;But you must also cause them to be scanned when the DOC file
203 ;is generated. For VMS, you must edit ../vms/makedoc.com.
204 ;For other systems, you must edit ../src/Makefile.in.
205 (if (load "site-load" t)
206 (garbage-collect))
207
208 (if (fboundp 'x-popup-menu)
209 (precompute-menubar-bindings))
210 ;; Turn on recording of which commands get rebound,
211 ;; for the sake of the next call to precompute-menubar-bindings.
212 (setq define-key-rebound-commands nil)
213
214 ;; Determine which last version number to use
215 ;; based on the executables that now exist.
216 (if (and (or (equal (nth 3 command-line-args) "dump")
217 (equal (nth 4 command-line-args) "dump"))
218 (not (eq system-type 'ms-dos)))
219 (let* ((base (concat "emacs-" emacs-version "."))
220 (files (file-name-all-completions base default-directory))
221 (versions (mapcar (function (lambda (name)
222 (string-to-int (substring name (length base)))))
223 files)))
224 ;; `emacs-version' is a constant, so we shouldn't change it with `setq'.
225 (defconst emacs-version
226 (format "%s.%d"
227 emacs-version (if versions (1+ (apply 'max versions)) 1)))))
228
229 ;; Note: all compiled Lisp files loaded above this point
230 ;; must be among the ones parsed by make-docfile
231 ;; to construct DOC. Any that are not processed
232 ;; for DOC will not have doc strings in the dumped Emacs.
233
234 (message "Finding pointers to doc strings...")
235 (if (or (equal (nth 3 command-line-args) "dump")
236 (equal (nth 4 command-line-args) "dump"))
237 (let ((name emacs-version))
238 (while (string-match "[^-+_.a-zA-Z0-9]+" name)
239 (setq name (concat (downcase (substring name 0 (match-beginning 0)))
240 "-"
241 (substring name (match-end 0)))))
242 (if (memq system-type '(ms-dos windows-nt))
243 (setq name (expand-file-name
244 (if (fboundp 'x-create-frame) "DOC-X" "DOC") "../etc"))
245 (setq name (concat (expand-file-name "../etc/DOC-") name))
246 (if (file-exists-p name)
247 (delete-file name))
248 (copy-file (expand-file-name "../etc/DOC") name t))
249 (Snarf-documentation (file-name-nondirectory name)))
250 (condition-case nil
251 (Snarf-documentation "DOC")
252 (error nil)))
253 (message "Finding pointers to doc strings...done")
254
255 ;;;Note: You can cause additional libraries to be preloaded
256 ;;;by writing a site-init.el that loads them.
257 ;;;See also "site-load" above.
258 (load "site-init" t)
259 (setq current-load-list nil)
260
261 ;; Write the value of load-history into fns-VERSION.el,
262 ;; then clear out load-history.
263 ;; (if (or (equal (nth 3 command-line-args) "dump")
264 ;; (equal (nth 4 command-line-args) "dump"))
265 ;; (let ((buffer-undo-list t))
266 ;; (princ "(setq load-history\n" (current-buffer))
267 ;; (princ " (nconc load-history\n" (current-buffer))
268 ;; (princ " '(" (current-buffer))
269 ;; (let ((tem load-history))
270 ;; (while tem
271 ;; (prin1 (car tem) (current-buffer))
272 ;; (terpri (current-buffer))
273 ;; (if (cdr tem)
274 ;; (princ " " (current-buffer)))
275 ;; (setq tem (cdr tem))))
276 ;; (princ ")))\n" (current-buffer))
277 ;; (write-region (point-min) (point-max)
278 ;; (expand-file-name
279 ;; (cond
280 ;; ((eq system-type 'ms-dos)
281 ;; "../lib-src/fns.el")
282 ;; ((eq system-type 'windows-nt)
283 ;; (format "../../../lib-src/fns-%s.el" emacs-version))
284 ;; (t
285 ;; (format "../lib-src/fns-%s.el" emacs-version)))
286 ;; invocation-directory))
287 ;; (erase-buffer)
288 ;; (setq load-history nil))
289 ;; (setq symbol-file-load-history-loaded t))
290 ;; We don't use this fns-*.el file. Instead we keep the data in PURE space.
291 ;; Make sure that the spine of the list is not in pure space because it can
292 ;; be destructively mutated in lread.c:build_load_history.
293 (setq load-history (mapcar 'purecopy load-history))
294 (setq symbol-file-load-history-loaded t)
295
296 (set-buffer-modified-p nil)
297
298 ;; reset the load-path. See lread.c:init_lread why.
299 (if (or (equal (nth 3 command-line-args) "bootstrap")
300 (equal (nth 4 command-line-args) "bootstrap"))
301 (setcdr load-path nil))
302
303 (garbage-collect)
304
305 ;;; At this point, we're ready to resume undo recording for scratch.
306 (buffer-enable-undo "*scratch*")
307
308 (if (null (garbage-collect))
309 (setq pure-space-overflow t))
310
311 (if (or (member (nth 3 command-line-args) '("dump" "bootstrap"))
312 (member (nth 4 command-line-args) '("dump" "bootstrap")))
313 (if (eq system-type 'vax-vms)
314 (progn
315 (message "Dumping data as file temacs.dump")
316 (dump-emacs "temacs.dump" "temacs")
317 (kill-emacs))
318 (let ((name (concat "emacs-" emacs-version)))
319 (while (string-match "[^-+_.a-zA-Z0-9]+" name)
320 (setq name (concat (downcase (substring name 0 (match-beginning 0)))
321 "-"
322 (substring name (match-end 0)))))
323 (if (memq system-type '(ms-dos windows-nt cygwin))
324 (message "Dumping under the name emacs")
325 (message "Dumping under names emacs and %s" name)))
326 (condition-case ()
327 (delete-file "emacs")
328 (file-error nil))
329 ;; We used to dump under the name xemacs, but that occasionally
330 ;; confused people installing Emacs (they'd install the file
331 ;; under the name `xemacs'), and it's inconsistent with every
332 ;; other GNU program's build process.
333 (dump-emacs "emacs" "temacs")
334 (message "%d pure bytes used" pure-bytes-used)
335 ;; Recompute NAME now, so that it isn't set when we dump.
336 (if (not (memq system-type '(ms-dos windows-nt cygwin)))
337 (let ((name (concat "emacs-" emacs-version)))
338 (while (string-match "[^-+_.a-zA-Z0-9]+" name)
339 (setq name (concat (downcase (substring name 0 (match-beginning 0)))
340 "-"
341 (substring name (match-end 0)))))
342 (add-name-to-file "emacs" name t)))
343 (kill-emacs)))
344
345 ;; Avoid error if user loads some more libraries now.
346 (setq purify-flag nil)
347
348 ;; For machines with CANNOT_DUMP defined in config.h,
349 ;; this file must be loaded each time Emacs is run.
350 ;; So run the startup code now. First, remove `-l loadup' from args.
351
352 (if (and (equal (nth 1 command-line-args) "-l")
353 (equal (nth 2 command-line-args) "loadup"))
354 (setcdr command-line-args (nthcdr 3 command-line-args)))
355
356 (eval top-level)
357
358 \f
359 ;;; Local Variables:
360 ;;; no-byte-compile: t
361 ;;; no-update-autoloads: t
362 ;;; End:
363
364 ;;; arch-tag: 121e1dd4-36e1-45ac-860e-239f577a6335
365 ;;; loadup.el ends here