Commit | Line | Data |
---|---|---|
55535639 | 1 | ;;; loadup.el --- load up standardly loaded Lisp files for Emacs |
6594deb0 | 2 | |
5db04750 | 3 | ;; Copyright (C) 1985, 1986, 1992, 1994, 2001 Free Software Foundation, Inc. |
eea8d4ef | 4 | |
e5167999 | 5 | ;; Maintainer: FSF |
fd7fa35a | 6 | ;; Keywords: internal |
e5167999 | 7 | |
0d20f9a0 JB |
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 | |
e5167999 | 12 | ;; the Free Software Foundation; either version 2, or (at your option) |
0d20f9a0 JB |
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 | |
b578f267 EN |
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. | |
0d20f9a0 | 24 | |
eea8d4ef ER |
25 | ;;; Commentary: |
26 | ||
27 | ;; This is loaded into a bare Emacs to make a dumpable one. | |
28 | ||
e5167999 ER |
29 | ;;; Code: |
30 | ||
ce87039d SM |
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") | |
49fc4500 KR |
34 | (equal (nth 4 command-line-args) "bootstrap") |
35 | ;; in case CANNOT_DUMP | |
36 | (equal (nth 0 command-line-args) "../src/bootstrap-emacs")) | |
ce87039d | 37 | (let ((path (car load-path))) |
397869a4 SM |
38 | ;; We'll probably overflow the pure space. |
39 | (setq purify-flag nil) | |
ce87039d SM |
40 | (setq load-path (list path |
41 | (expand-file-name "emacs-lisp" path) | |
94995927 | 42 | (expand-file-name "language" path) |
ce87039d SM |
43 | (expand-file-name "international" path))))) |
44 | ||
8c74709f | 45 | (message "Using load-path %s" load-path) |
8c74709f | 46 | |
86db31d5 | 47 | ;; We don't want to have any undo records in the dumped Emacs. |
ffd56f97 | 48 | (buffer-disable-undo "*scratch*") |
0d20f9a0 | 49 | |
8f89dc56 | 50 | (load "byte-run") |
86db31d5 | 51 | (load "emacs-lisp/backquote") |
0d20f9a0 | 52 | (load "subr") |
15897347 RS |
53 | |
54 | ;; We specify .el in case someone compiled version.el by mistake. | |
55 | (load "version.el") | |
56 | ||
d038ca1d | 57 | (load "widget") |
d038ca1d | 58 | (load "custom") |
ce87039d | 59 | (load "map-ynp") |
b27f23c1 | 60 | (load "env") |
4d100a01 | 61 | (load "cus-start") |
5dcd1261 | 62 | (load "international/mule") |
5dcd1261 | 63 | (load "international/mule-conf.el") ;Don't get confused if someone compiled this by mistake. |
8f89dc56 | 64 | (load "format") |
9b73022f RS |
65 | (load "bindings") |
66 | (setq load-source-file-function 'load-with-code-conversion) | |
0d20f9a0 | 67 | (load "simple") |
0d20f9a0 | 68 | (load "files") |
838d57f6 | 69 | |
3fad47d8 | 70 | (load "cus-face") |
d6af189a MB |
71 | (load "faces") ; after here, `defface' may be used. |
72 | ||
6f76277f RS |
73 | (message "Lists of integers (garbage collection statistics) are normal output") |
74 | (message "while building Emacs; they do not indicate a problem.") | |
838d57f6 RS |
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 | ||
301d6830 | 79 | (load "help") |
d6af189a | 80 | |
301d6830 GM |
81 | ;; Any Emacs Lisp source file (*.el) loaded here after can contain |
82 | ;; multilingual text. | |
83 | (load "international/mule-cmds") | |
84 | (load "case-table") | |
c546dfcb | 85 | (load "international/utf-8") |
b0c654c0 | 86 | (load "international/characters") |
301d6830 | 87 | |
939f6e3f | 88 | (let ((set-case-syntax-set-multibyte t)) |
5dcd1261 RS |
89 | (load "international/latin-1") |
90 | (load "international/latin-2") | |
91 | (load "international/latin-3") | |
92 | (load "international/latin-4") | |
902e7be8 DL |
93 | (load "international/latin-5") |
94 | (load "international/latin-8") | |
95 | (load "international/latin-9")) | |
8f89dc56 | 96 | ;; Load language-specific files. |
5e14f0f5 | 97 | (load "language/chinese") |
5e14f0f5 | 98 | (load "language/cyrillic") |
5e14f0f5 | 99 | (load "language/indian") |
ba114d2f | 100 | (load "language/devanagari") ; This should be loaded after indian. |
4366b45e | 101 | (load "language/english") |
5e14f0f5 | 102 | (load "language/ethiopic") |
5e14f0f5 | 103 | (load "language/european") |
c90c0be0 RS |
104 | (load "language/czech") |
105 | (load "language/slovak") | |
23e7714e | 106 | (load "language/romanian") |
5e14f0f5 | 107 | (load "language/greek") |
5e14f0f5 | 108 | (load "language/hebrew") |
5e14f0f5 | 109 | (load "language/japanese") |
5e14f0f5 | 110 | (load "language/korean") |
f35c859c | 111 | (load "language/lao") |
5e14f0f5 | 112 | (load "language/thai") |
4366b45e | 113 | (load "language/tibetan") |
5e14f0f5 | 114 | (load "language/vietnamese") |
5e14f0f5 | 115 | (load "language/misc-lang") |
69c34764 DL |
116 | (load "language/utf-8-lang") |
117 | (load "language/georgian") | |
86db31d5 SM |
118 | |
119 | (load "international/ucs-tables") | |
4744f265 | 120 | (ucs-unify-8859 'encode-only) |
86db31d5 | 121 | |
4298d95e | 122 | (update-coding-systems-internal) |
838d57f6 | 123 | |
0d20f9a0 JB |
124 | (load "indent") |
125 | (load "window") | |
fd727f4a | 126 | (load "frame") |
f795f633 | 127 | (load "term/tty-colors") |
63a29a5d | 128 | (load "font-core") |
d6af189a | 129 | |
7a701b9f KH |
130 | (if (fboundp 'frame-face-alist) |
131 | (progn | |
7a701b9f KH |
132 | (load "facemenu"))) |
133 | (if (fboundp 'track-mouse) | |
134 | (progn | |
7a701b9f | 135 | (load "mouse") |
9315353b | 136 | (and (boundp 'x-toolkit-scroll-bars) |
449ab688 | 137 | (load "scroll-bar")) |
36974751 | 138 | (load "select"))) |
3fad47d8 | 139 | (load "timer") |
01c86c56 | 140 | (load "isearch") |
838d57f6 RS |
141 | |
142 | (message "%s" (garbage-collect)) | |
afcd9910 | 143 | (load "menu-bar") |
0d20f9a0 | 144 | (load "paths.el") ;Don't get confused if someone compiled paths by mistake. |
0d20f9a0 | 145 | (load "startup") |
5dcd1261 | 146 | (load "emacs-lisp/lisp") |
5dcd1261 | 147 | (load "textmodes/page") |
0d20f9a0 | 148 | (load "register") |
5dcd1261 | 149 | (load "textmodes/paragraphs") |
5dcd1261 | 150 | (load "emacs-lisp/lisp-mode") |
5dcd1261 | 151 | (load "textmodes/text-mode") |
5dcd1261 | 152 | (load "textmodes/fill") |
838d57f6 RS |
153 | (message "%s" (garbage-collect)) |
154 | ||
0d20f9a0 JB |
155 | (load "replace") |
156 | (if (eq system-type 'vax-vms) | |
157 | (progn | |
0d20f9a0 | 158 | (load "vmsproc"))) |
0d20f9a0 | 159 | (load "abbrev") |
0d20f9a0 JB |
160 | (load "buff-menu") |
161 | (if (eq system-type 'vax-vms) | |
162 | (progn | |
0d20f9a0 | 163 | (load "vms-patch"))) |
b7521474 RS |
164 | (if (eq system-type 'windows-nt) |
165 | (progn | |
b7521474 | 166 | (load "ls-lisp") |
234ae99a | 167 | (load "disp-table") ; needed to setup ibm-pc char set, see internal.el |
489f9371 | 168 | (load "dos-w32") |
9c6a562b | 169 | (load "w32-vars") |
63abf612 | 170 | (load "w32-fns"))) |
ed10e0ab RS |
171 | (if (eq system-type 'ms-dos) |
172 | (progn | |
173 | (load "ls-lisp") | |
489f9371 | 174 | (load "dos-w32") |
ed10e0ab | 175 | (load "dos-fns") |
7298263a | 176 | (load "dos-vars") |
6f676109 | 177 | (load "international/ccl") ; codepage.el uses CCL en/decoder |
aea543b4 | 178 | (load "international/codepage") ; internal.el uses cpNNN coding systems |
63abf612 | 179 | (load "disp-table"))) ; needed to setup ibm-pc char set, see internal.el |
591b63b4 AC |
180 | (if (eq system-type 'macos) |
181 | (progn | |
182 | (load "ls-lisp"))) | |
e04d21aa | 183 | (if (fboundp 'atan) ; preload some constants and |
63abf612 | 184 | (progn ; floating pt. functions if we have float support. |
0d20f9a0 | 185 | (load "float-sup"))) |
838d57f6 | 186 | (message "%s" (garbage-collect)) |
e4636528 | 187 | |
637a8ae9 | 188 | (load "vc-hooks") |
a63926db | 189 | (load "ediff-hook") |
838d57f6 | 190 | (message "%s" (garbage-collect)) |
0d20f9a0 JB |
191 | |
192 | ;If you want additional libraries to be preloaded and their | |
193 | ;doc strings kept in the DOC file rather than in core, | |
194 | ;you may load them with a "site-load.el" file. | |
195 | ;But you must also cause them to be scanned when the DOC file | |
87855006 | 196 | ;is generated. For VMS, you must edit ../vms/makedoc.com. |
fd322fae | 197 | ;For other systems, you must edit ../src/Makefile.in. |
0d20f9a0 JB |
198 | (if (load "site-load" t) |
199 | (garbage-collect)) | |
200 | ||
f5263a5c RS |
201 | (if (fboundp 'x-popup-menu) |
202 | (precompute-menubar-bindings)) | |
203 | ;; Turn on recording of which commands get rebound, | |
204 | ;; for the sake of the next call to precompute-menubar-bindings. | |
205 | (setq define-key-rebound-commands nil) | |
206 | ||
de78a7ba RS |
207 | ;; Determine which last version number to use |
208 | ;; based on the executables that now exist. | |
24cffc68 RS |
209 | (if (and (or (equal (nth 3 command-line-args) "dump") |
210 | (equal (nth 4 command-line-args) "dump")) | |
211 | (not (eq system-type 'ms-dos))) | |
0c39a403 | 212 | (let* ((base (concat "emacs-" emacs-version ".")) |
de78a7ba RS |
213 | (files (file-name-all-completions base default-directory)) |
214 | (versions (mapcar (function (lambda (name) | |
9b04b1b7 | 215 | (string-to-int (substring name (length base))))) |
de78a7ba | 216 | files))) |
86db31d5 SM |
217 | ;; `emacs-version' is a constant, so we shouldn't change it with `setq'. |
218 | (defconst emacs-version | |
219 | (format "%s.%d" | |
220 | emacs-version (if versions (1+ (apply 'max versions)) 1))))) | |
de78a7ba | 221 | |
0d20f9a0 JB |
222 | ;; Note: all compiled Lisp files loaded above this point |
223 | ;; must be among the ones parsed by make-docfile | |
224 | ;; to construct DOC. Any that are not processed | |
225 | ;; for DOC will not have doc strings in the dumped Emacs. | |
226 | ||
227 | (message "Finding pointers to doc strings...") | |
24cffc68 RS |
228 | (if (or (equal (nth 3 command-line-args) "dump") |
229 | (equal (nth 4 command-line-args) "dump")) | |
0d20f9a0 JB |
230 | (let ((name emacs-version)) |
231 | (while (string-match "[^-+_.a-zA-Z0-9]+" name) | |
232 | (setq name (concat (downcase (substring name 0 (match-beginning 0))) | |
233 | "-" | |
234 | (substring name (match-end 0))))) | |
b7521474 | 235 | (if (memq system-type '(ms-dos windows-nt)) |
87485d6f | 236 | (setq name (expand-file-name |
753a134f | 237 | (if (fboundp 'x-create-frame) "DOC-X" "DOC") "../etc")) |
ed10e0ab RS |
238 | (setq name (concat (expand-file-name "../etc/DOC-") name)) |
239 | (if (file-exists-p name) | |
240 | (delete-file name)) | |
241 | (copy-file (expand-file-name "../etc/DOC") name t)) | |
450a90e2 | 242 | (Snarf-documentation (file-name-nondirectory name))) |
ce87039d SM |
243 | (condition-case nil |
244 | (Snarf-documentation "DOC") | |
245 | (error nil))) | |
0d20f9a0 JB |
246 | (message "Finding pointers to doc strings...done") |
247 | ||
0f4b266c KH |
248 | ;;;Note: You can cause additional libraries to be preloaded |
249 | ;;;by writing a site-init.el that loads them. | |
250 | ;;;See also "site-load" above. | |
0d20f9a0 | 251 | (load "site-init" t) |
95227eb2 | 252 | (setq current-load-list nil) |
c2509060 | 253 | |
b7b75652 AS |
254 | ;; Write the value of load-history into fns-VERSION.el, |
255 | ;; then clear out load-history. | |
4744f265 SM |
256 | ;; (if (or (equal (nth 3 command-line-args) "dump") |
257 | ;; (equal (nth 4 command-line-args) "dump")) | |
258 | ;; (let ((buffer-undo-list t)) | |
259 | ;; (princ "(setq load-history\n" (current-buffer)) | |
260 | ;; (princ " (nconc load-history\n" (current-buffer)) | |
261 | ;; (princ " '(" (current-buffer)) | |
262 | ;; (let ((tem load-history)) | |
263 | ;; (while tem | |
264 | ;; (prin1 (car tem) (current-buffer)) | |
265 | ;; (terpri (current-buffer)) | |
266 | ;; (if (cdr tem) | |
267 | ;; (princ " " (current-buffer))) | |
268 | ;; (setq tem (cdr tem)))) | |
269 | ;; (princ ")))\n" (current-buffer)) | |
270 | ;; (write-region (point-min) (point-max) | |
271 | ;; (expand-file-name | |
272 | ;; (cond | |
273 | ;; ((eq system-type 'ms-dos) | |
274 | ;; "../lib-src/fns.el") | |
275 | ;; ((eq system-type 'windows-nt) | |
276 | ;; (format "../../../lib-src/fns-%s.el" emacs-version)) | |
277 | ;; (t | |
278 | ;; (format "../lib-src/fns-%s.el" emacs-version))) | |
279 | ;; invocation-directory)) | |
280 | ;; (erase-buffer) | |
281 | ;; (setq load-history nil)) | |
282 | ;; (setq symbol-file-load-history-loaded t)) | |
283 | ;; We don't use this fns-*.el file. Instead we keep the data in PURE space. | |
284 | ;; Make sure that the spine of the list is not in pure space because it can | |
285 | ;; be destructively mutated in lread.c:build_load_history. | |
286 | (setq load-history (mapcar 'purecopy load-history)) | |
287 | (setq symbol-file-load-history-loaded t) | |
288 | ||
b7b75652 | 289 | (set-buffer-modified-p nil) |
c2509060 | 290 | |
ce87039d SM |
291 | ;; reset the load-path. See lread.c:init_lread why. |
292 | (if (or (equal (nth 3 command-line-args) "bootstrap") | |
293 | (equal (nth 4 command-line-args) "bootstrap")) | |
294 | (setcdr load-path nil)) | |
295 | ||
0d20f9a0 JB |
296 | (garbage-collect) |
297 | ||
ffd56f97 JB |
298 | ;;; At this point, we're ready to resume undo recording for scratch. |
299 | (buffer-enable-undo "*scratch*") | |
300 | ||
ce87039d SM |
301 | (if (or (member (nth 3 command-line-args) '("dump" "bootstrap")) |
302 | (member (nth 4 command-line-args) '("dump" "bootstrap"))) | |
0d20f9a0 | 303 | (if (eq system-type 'vax-vms) |
e04d21aa | 304 | (progn |
0d20f9a0 JB |
305 | (message "Dumping data as file temacs.dump") |
306 | (dump-emacs "temacs.dump" "temacs") | |
307 | (kill-emacs)) | |
308 | (let ((name (concat "emacs-" emacs-version))) | |
309 | (while (string-match "[^-+_.a-zA-Z0-9]+" name) | |
310 | (setq name (concat (downcase (substring name 0 (match-beginning 0))) | |
311 | "-" | |
312 | (substring name (match-end 0))))) | |
ed10e0ab RS |
313 | (if (eq system-type 'ms-dos) |
314 | (message "Dumping under the name emacs") | |
315 | (message "Dumping under names emacs and %s" name))) | |
0d20f9a0 | 316 | (condition-case () |
59f3e9a2 | 317 | (delete-file "emacs") |
0d20f9a0 | 318 | (file-error nil)) |
59f3e9a2 JB |
319 | ;; We used to dump under the name xemacs, but that occasionally |
320 | ;; confused people installing Emacs (they'd install the file | |
321 | ;; under the name `xemacs'), and it's inconsistent with every | |
0f4b266c | 322 | ;; other GNU program's build process. |
59f3e9a2 | 323 | (dump-emacs "emacs" "temacs") |
4d337390 | 324 | (message "%d pure bytes used" pure-bytes-used) |
0d20f9a0 | 325 | ;; Recompute NAME now, so that it isn't set when we dump. |
ea3e2043 | 326 | (if (not (memq system-type '(ms-dos windows-nt))) |
ed10e0ab RS |
327 | (let ((name (concat "emacs-" emacs-version))) |
328 | (while (string-match "[^-+_.a-zA-Z0-9]+" name) | |
329 | (setq name (concat (downcase (substring name 0 (match-beginning 0))) | |
330 | "-" | |
331 | (substring name (match-end 0))))) | |
332 | (add-name-to-file "emacs" name t))) | |
0d20f9a0 JB |
333 | (kill-emacs))) |
334 | ||
335 | ;; Avoid error if user loads some more libraries now. | |
336 | (setq purify-flag nil) | |
337 | ||
338 | ;; For machines with CANNOT_DUMP defined in config.h, | |
339 | ;; this file must be loaded each time Emacs is run. | |
7fa26c0a | 340 | ;; So run the startup code now. First, remove `-l loadup' from args. |
0d20f9a0 | 341 | |
7fa26c0a KH |
342 | (if (and (equal (nth 1 command-line-args) "-l") |
343 | (equal (nth 2 command-line-args) "loadup")) | |
344 | (setcdr command-line-args (nthcdr 3 command-line-args))) | |
345 | ||
346 | (eval top-level) | |
6594deb0 | 347 | |
86db31d5 SM |
348 | \f |
349 | ;;; Local Variables: | |
350 | ;;; no-byte-compile: t | |
351 | ;;; no-update-autoloads: t | |
352 | ;;; End: | |
6594deb0 | 353 | ;;; loadup.el ends here |