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