Commit | Line | Data |
---|---|---|
55535639 | 1 | ;;; loadup.el --- load up standardly loaded Lisp files for Emacs |
6594deb0 | 2 | |
4f32d22e GM |
3 | ;; Copyright (C) 1985, 1986, 1992, 1994, 2001, 2002, 2003, 2004, 2005, |
4 | ;; 2006, 2007, 2008, 2009 Free Software Foundation, Inc. | |
eea8d4ef | 5 | |
e5167999 | 6 | ;; Maintainer: FSF |
fd7fa35a | 7 | ;; Keywords: internal |
e5167999 | 8 | |
0d20f9a0 JB |
9 | ;; This file is part of GNU Emacs. |
10 | ||
eb3fa2cf | 11 | ;; GNU Emacs is free software: you can redistribute it and/or modify |
0d20f9a0 | 12 | ;; it under the terms of the GNU General Public License as published by |
eb3fa2cf GM |
13 | ;; the Free Software Foundation, either version 3 of the License, or |
14 | ;; (at your option) any later version. | |
0d20f9a0 JB |
15 | |
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. | |
20 | ||
21 | ;; You should have received a copy of the GNU General Public License | |
eb3fa2cf | 22 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
0d20f9a0 | 23 | |
eea8d4ef ER |
24 | ;;; Commentary: |
25 | ||
26 | ;; This is loaded into a bare Emacs to make a dumpable one. | |
27 | ||
e5167999 ER |
28 | ;;; Code: |
29 | ||
ce87039d SM |
30 | ;; add subdirectories to the load-path for files that might |
31 | ;; get autoloaded when bootstrapping | |
32 | (if (or (equal (nth 3 command-line-args) "bootstrap") | |
49fc4500 | 33 | (equal (nth 4 command-line-args) "bootstrap") |
3579a658 KH |
34 | (equal (nth 3 command-line-args) "unidata-gen.el") |
35 | (equal (nth 4 command-line-args) "unidata-gen-files") | |
49fc4500 KR |
36 | ;; in case CANNOT_DUMP |
37 | (equal (nth 0 command-line-args) "../src/bootstrap-emacs")) | |
ceec5b6d | 38 | (let ((dir (car load-path))) |
397869a4 SM |
39 | ;; We'll probably overflow the pure space. |
40 | (setq purify-flag nil) | |
ceec5b6d RS |
41 | (setq load-path (list dir |
42 | (expand-file-name "emacs-lisp" dir) | |
43 | (expand-file-name "language" dir) | |
44 | (expand-file-name "international" dir) | |
45 | (expand-file-name "textmodes" dir))))) | |
ce87039d | 46 | |
8c74709f | 47 | (message "Using load-path %s" load-path) |
8c74709f | 48 | |
8c766df1 KH |
49 | (if (or (member (nth 3 command-line-args) '("dump" "bootstrap")) |
50 | (member (nth 4 command-line-args) '("dump" "bootstrap"))) | |
51 | ;; To reduce the size of dumped Emacs, we avoid making huge | |
52 | ;; char-tables. | |
53 | (setq inhibit-load-charset-map t)) | |
54 | ||
86db31d5 | 55 | ;; We don't want to have any undo records in the dumped Emacs. |
f6e43712 RS |
56 | (set-buffer "*scratch*") |
57 | (setq buffer-undo-list t) | |
0d20f9a0 | 58 | |
693e59d6 | 59 | (load "emacs-lisp/byte-run") |
86db31d5 | 60 | (load "emacs-lisp/backquote") |
0d20f9a0 | 61 | (load "subr") |
15897347 RS |
62 | |
63 | ;; We specify .el in case someone compiled version.el by mistake. | |
64 | (load "version.el") | |
65 | ||
d038ca1d | 66 | (load "widget") |
d038ca1d | 67 | (load "custom") |
693e59d6 | 68 | (load "emacs-lisp/map-ynp") |
4d100a01 | 69 | (load "cus-start") |
5dcd1261 | 70 | (load "international/mule") |
5dcd1261 | 71 | (load "international/mule-conf.el") ;Don't get confused if someone compiled this by mistake. |
911650d2 | 72 | (load "env") |
8f89dc56 | 73 | (load "format") |
9b73022f RS |
74 | (load "bindings") |
75 | (setq load-source-file-function 'load-with-code-conversion) | |
0d20f9a0 | 76 | (load "files") |
838d57f6 | 77 | |
3fad47d8 | 78 | (load "cus-face") |
d6af189a | 79 | (load "faces") ; after here, `defface' may be used. |
beec574c | 80 | (load "minibuffer") |
d6af189a | 81 | |
d4e9f067 JL |
82 | (load "button") |
83 | (load "startup") | |
84 | ||
6f76277f RS |
85 | (message "Lists of integers (garbage collection statistics) are normal output") |
86 | (message "while building Emacs; they do not indicate a problem.") | |
838d57f6 | 87 | (message "%s" (garbage-collect)) |
23c2e0e4 SM |
88 | |
89 | (condition-case nil | |
90 | ;; Don't get confused if someone compiled this by mistake. | |
91 | (load "loaddefs.el") | |
92 | ;; In case loaddefs hasn't been generated yet. | |
93 | (file-error (load "ldefs-boot.el"))) | |
94 | ||
838d57f6 | 95 | (message "%s" (garbage-collect)) |
e2947429 | 96 | (load "abbrev") ;lisp-mode.el and simple.el use define-abbrev-table. |
3bce0243 | 97 | (load "simple") |
838d57f6 | 98 | |
301d6830 | 99 | (load "help") |
d6af189a | 100 | |
274925df | 101 | (load "jka-cmpr-hook") |
8900c52c | 102 | (load "epa-hook") |
301d6830 GM |
103 | ;; Any Emacs Lisp source file (*.el) loaded here after can contain |
104 | ;; multilingual text. | |
105 | (load "international/mule-cmds") | |
106 | (load "case-table") | |
b0c654c0 | 107 | (load "international/characters") |
d8b52430 | 108 | (load "composite") |
90ce1bb9 KH |
109 | ;; This file doesn't exist when building Emacs from CVS. It is |
110 | ;; generated just after temacs is build. | |
111 | (load "international/charprop.el" t) | |
301d6830 | 112 | |
8f89dc56 | 113 | ;; Load language-specific files. |
5e14f0f5 | 114 | (load "language/chinese") |
5e14f0f5 | 115 | (load "language/cyrillic") |
5e14f0f5 | 116 | (load "language/indian") |
43d8c495 | 117 | (load "language/sinhala") |
4366b45e | 118 | (load "language/english") |
5e14f0f5 | 119 | (load "language/ethiopic") |
5e14f0f5 | 120 | (load "language/european") |
c90c0be0 RS |
121 | (load "language/czech") |
122 | (load "language/slovak") | |
23e7714e | 123 | (load "language/romanian") |
5e14f0f5 | 124 | (load "language/greek") |
5e14f0f5 | 125 | (load "language/hebrew") |
5e14f0f5 | 126 | (load "language/japanese") |
5e14f0f5 | 127 | (load "language/korean") |
f35c859c | 128 | (load "language/lao") |
201bc379 | 129 | (load "language/tai-viet") |
5e14f0f5 | 130 | (load "language/thai") |
4366b45e | 131 | (load "language/tibetan") |
5e14f0f5 | 132 | (load "language/vietnamese") |
5e14f0f5 | 133 | (load "language/misc-lang") |
69c34764 DL |
134 | (load "language/utf-8-lang") |
135 | (load "language/georgian") | |
44f44190 | 136 | (load "language/khmer") |
f81e37a0 | 137 | (load "language/burmese") |
b03e8a93 | 138 | (load "language/cham") |
86db31d5 | 139 | |
0d20f9a0 JB |
140 | (load "indent") |
141 | (load "window") | |
fd727f4a | 142 | (load "frame") |
f795f633 | 143 | (load "term/tty-colors") |
63a29a5d | 144 | (load "font-core") |
633537d7 LT |
145 | ;; facemenu must be loaded before font-lock, because `facemenu-keymap' |
146 | ;; needs to be defined when font-lock is loaded. | |
a4a19809 | 147 | (load "facemenu") |
c94f08ff DN |
148 | (load "emacs-lisp/syntax") |
149 | (load "font-lock") | |
150 | (load "jit-lock") | |
d6af189a | 151 | |
7a701b9f KH |
152 | (if (fboundp 'track-mouse) |
153 | (progn | |
7a701b9f | 154 | (load "mouse") |
9315353b | 155 | (and (boundp 'x-toolkit-scroll-bars) |
449ab688 | 156 | (load "scroll-bar")) |
36974751 | 157 | (load "select"))) |
693e59d6 | 158 | (load "emacs-lisp/timer") |
01c86c56 | 159 | (load "isearch") |
1f423851 | 160 | (load "rfn-eshadow") |
838d57f6 RS |
161 | |
162 | (message "%s" (garbage-collect)) | |
afcd9910 | 163 | (load "menu-bar") |
0d20f9a0 | 164 | (load "paths.el") ;Don't get confused if someone compiled paths by mistake. |
5dcd1261 | 165 | (load "emacs-lisp/lisp") |
5dcd1261 | 166 | (load "textmodes/page") |
0d20f9a0 | 167 | (load "register") |
5dcd1261 | 168 | (load "textmodes/paragraphs") |
5dcd1261 | 169 | (load "emacs-lisp/lisp-mode") |
5dcd1261 | 170 | (load "textmodes/text-mode") |
5dcd1261 | 171 | (load "textmodes/fill") |
838d57f6 RS |
172 | (message "%s" (garbage-collect)) |
173 | ||
0d20f9a0 | 174 | (load "replace") |
0d20f9a0 | 175 | (load "buff-menu") |
165b0fa0 RS |
176 | |
177 | (if (fboundp 'x-create-frame) | |
178 | (progn | |
e541cbfc | 179 | (load "fringe") |
165b0fa0 RS |
180 | (load "image") |
181 | (load "international/fontset") | |
182 | (load "dnd") | |
165b0fa0 RS |
183 | (load "tool-bar"))) |
184 | (if (featurep 'x) | |
ddaa8057 | 185 | (progn |
9d488d86 | 186 | (load "x-dnd") |
d5e4dda5 | 187 | (load "term/common-win") |
79c3172f | 188 | (load "term/x-win"))) |
d5e4dda5 | 189 | |
165b0fa0 RS |
190 | (message "%s" (garbage-collect)) |
191 | ||
b7521474 RS |
192 | (if (eq system-type 'windows-nt) |
193 | (progn | |
729f1525 | 194 | (load "w32-vars") |
d5e4dda5 | 195 | (load "term/common-win") |
ddaa8057 | 196 | (load "term/w32-win") |
b7521474 | 197 | (load "ls-lisp") |
bbe44805 | 198 | (load "disp-table") |
489f9371 | 199 | (load "dos-w32") |
63abf612 | 200 | (load "w32-fns"))) |
ed10e0ab RS |
201 | (if (eq system-type 'ms-dos) |
202 | (progn | |
489f9371 | 203 | (load "dos-w32") |
ed10e0ab | 204 | (load "dos-fns") |
7298263a | 205 | (load "dos-vars") |
bbe44805 EZ |
206 | ;; Don't load term/common-win: it isn't appropriate for the `pc' |
207 | ;; ``window system'', which generally behaves like a terminal. | |
208 | (load "term/pc-win") | |
209 | (load "ls-lisp") | |
63abf612 | 210 | (load "disp-table"))) ; needed to setup ibm-pc char set, see internal.el |
601fb9b8 | 211 | (if (featurep 'ns) |
edfda783 AR |
212 | (progn |
213 | (load "emacs-lisp/easymenu") ;; for platform-related menu adjustments | |
edfda783 | 214 | (load "term/ns-win"))) |
ab5c0fcd SM |
215 | (if (fboundp 'x-create-frame) |
216 | ;; Do it after loading term/foo-win.el since the value of the | |
217 | ;; mouse-wheel-*-event vars depends on those files being loaded or not. | |
218 | (load "mwheel")) | |
e04d21aa | 219 | (if (fboundp 'atan) ; preload some constants and |
63abf612 | 220 | (progn ; floating pt. functions if we have float support. |
693e59d6 | 221 | (load "emacs-lisp/float-sup"))) |
838d57f6 | 222 | (message "%s" (garbage-collect)) |
e4636528 | 223 | |
637a8ae9 | 224 | (load "vc-hooks") |
a63926db | 225 | (load "ediff-hook") |
8a902fd2 | 226 | (if (fboundp 'x-show-tip) (load "tooltip")) |
165b0fa0 | 227 | |
838d57f6 | 228 | (message "%s" (garbage-collect)) |
0d20f9a0 JB |
229 | |
230 | ;If you want additional libraries to be preloaded and their | |
231 | ;doc strings kept in the DOC file rather than in core, | |
232 | ;you may load them with a "site-load.el" file. | |
233 | ;But you must also cause them to be scanned when the DOC file | |
7c2fb837 | 234 | ;is generated. |
fd322fae | 235 | ;For other systems, you must edit ../src/Makefile.in. |
0d20f9a0 JB |
236 | (if (load "site-load" t) |
237 | (garbage-collect)) | |
238 | ||
de78a7ba RS |
239 | ;; Determine which last version number to use |
240 | ;; based on the executables that now exist. | |
24cffc68 RS |
241 | (if (and (or (equal (nth 3 command-line-args) "dump") |
242 | (equal (nth 4 command-line-args) "dump")) | |
243 | (not (eq system-type 'ms-dos))) | |
0c39a403 | 244 | (let* ((base (concat "emacs-" emacs-version ".")) |
de78a7ba RS |
245 | (files (file-name-all-completions base default-directory)) |
246 | (versions (mapcar (function (lambda (name) | |
9b04b1b7 | 247 | (string-to-int (substring name (length base))))) |
de78a7ba | 248 | files))) |
86db31d5 SM |
249 | ;; `emacs-version' is a constant, so we shouldn't change it with `setq'. |
250 | (defconst emacs-version | |
251 | (format "%s.%d" | |
252 | emacs-version (if versions (1+ (apply 'max versions)) 1))))) | |
de78a7ba | 253 | |
0d20f9a0 JB |
254 | ;; Note: all compiled Lisp files loaded above this point |
255 | ;; must be among the ones parsed by make-docfile | |
256 | ;; to construct DOC. Any that are not processed | |
257 | ;; for DOC will not have doc strings in the dumped Emacs. | |
4f32d22e GM |
258 | ;; Note also that any uncompiled files that are loaded should |
259 | ;; have doc-strings that conform to the make-docfile convention. | |
0d20f9a0 JB |
260 | |
261 | (message "Finding pointers to doc strings...") | |
24cffc68 RS |
262 | (if (or (equal (nth 3 command-line-args) "dump") |
263 | (equal (nth 4 command-line-args) "dump")) | |
0d20f9a0 JB |
264 | (let ((name emacs-version)) |
265 | (while (string-match "[^-+_.a-zA-Z0-9]+" name) | |
266 | (setq name (concat (downcase (substring name 0 (match-beginning 0))) | |
267 | "-" | |
268 | (substring name (match-end 0))))) | |
b7521474 | 269 | (if (memq system-type '(ms-dos windows-nt)) |
87485d6f | 270 | (setq name (expand-file-name |
753a134f | 271 | (if (fboundp 'x-create-frame) "DOC-X" "DOC") "../etc")) |
ed10e0ab RS |
272 | (setq name (concat (expand-file-name "../etc/DOC-") name)) |
273 | (if (file-exists-p name) | |
274 | (delete-file name)) | |
275 | (copy-file (expand-file-name "../etc/DOC") name t)) | |
450a90e2 | 276 | (Snarf-documentation (file-name-nondirectory name))) |
ce87039d SM |
277 | (condition-case nil |
278 | (Snarf-documentation "DOC") | |
279 | (error nil))) | |
0d20f9a0 JB |
280 | (message "Finding pointers to doc strings...done") |
281 | ||
0f4b266c KH |
282 | ;;;Note: You can cause additional libraries to be preloaded |
283 | ;;;by writing a site-init.el that loads them. | |
284 | ;;;See also "site-load" above. | |
0d20f9a0 | 285 | (load "site-init" t) |
95227eb2 | 286 | (setq current-load-list nil) |
c2509060 | 287 | |
b7b75652 AS |
288 | ;; Write the value of load-history into fns-VERSION.el, |
289 | ;; then clear out load-history. | |
4744f265 SM |
290 | ;; (if (or (equal (nth 3 command-line-args) "dump") |
291 | ;; (equal (nth 4 command-line-args) "dump")) | |
292 | ;; (let ((buffer-undo-list t)) | |
293 | ;; (princ "(setq load-history\n" (current-buffer)) | |
294 | ;; (princ " (nconc load-history\n" (current-buffer)) | |
295 | ;; (princ " '(" (current-buffer)) | |
296 | ;; (let ((tem load-history)) | |
297 | ;; (while tem | |
298 | ;; (prin1 (car tem) (current-buffer)) | |
299 | ;; (terpri (current-buffer)) | |
300 | ;; (if (cdr tem) | |
301 | ;; (princ " " (current-buffer))) | |
302 | ;; (setq tem (cdr tem)))) | |
303 | ;; (princ ")))\n" (current-buffer)) | |
304 | ;; (write-region (point-min) (point-max) | |
305 | ;; (expand-file-name | |
306 | ;; (cond | |
307 | ;; ((eq system-type 'ms-dos) | |
308 | ;; "../lib-src/fns.el") | |
309 | ;; ((eq system-type 'windows-nt) | |
310 | ;; (format "../../../lib-src/fns-%s.el" emacs-version)) | |
311 | ;; (t | |
312 | ;; (format "../lib-src/fns-%s.el" emacs-version))) | |
313 | ;; invocation-directory)) | |
314 | ;; (erase-buffer) | |
315 | ;; (setq load-history nil)) | |
316 | ;; (setq symbol-file-load-history-loaded t)) | |
317 | ;; We don't use this fns-*.el file. Instead we keep the data in PURE space. | |
318 | ;; Make sure that the spine of the list is not in pure space because it can | |
319 | ;; be destructively mutated in lread.c:build_load_history. | |
320 | (setq load-history (mapcar 'purecopy load-history)) | |
321 | (setq symbol-file-load-history-loaded t) | |
322 | ||
b7b75652 | 323 | (set-buffer-modified-p nil) |
c2509060 | 324 | |
ce87039d SM |
325 | ;; reset the load-path. See lread.c:init_lread why. |
326 | (if (or (equal (nth 3 command-line-args) "bootstrap") | |
327 | (equal (nth 4 command-line-args) "bootstrap")) | |
328 | (setcdr load-path nil)) | |
329 | ||
8c766df1 | 330 | (setq inhibit-load-charset-map nil) |
5bb65bd4 | 331 | (clear-charset-maps) |
0d20f9a0 JB |
332 | (garbage-collect) |
333 | ||
ffd56f97 JB |
334 | ;;; At this point, we're ready to resume undo recording for scratch. |
335 | (buffer-enable-undo "*scratch*") | |
336 | ||
6a4803ec RS |
337 | (if (null (garbage-collect)) |
338 | (setq pure-space-overflow t)) | |
339 | ||
ce87039d SM |
340 | (if (or (member (nth 3 command-line-args) '("dump" "bootstrap")) |
341 | (member (nth 4 command-line-args) '("dump" "bootstrap"))) | |
7c2fb837 | 342 | (progn |
fc46d219 SM |
343 | (if (memq system-type '(ms-dos windows-nt cygwin)) |
344 | (message "Dumping under the name emacs") | |
345 | (message "Dumping under the name emacs")) | |
0d20f9a0 | 346 | (condition-case () |
59f3e9a2 | 347 | (delete-file "emacs") |
0d20f9a0 | 348 | (file-error nil)) |
59f3e9a2 JB |
349 | ;; We used to dump under the name xemacs, but that occasionally |
350 | ;; confused people installing Emacs (they'd install the file | |
351 | ;; under the name `xemacs'), and it's inconsistent with every | |
0f4b266c | 352 | ;; other GNU program's build process. |
59f3e9a2 | 353 | (dump-emacs "emacs" "temacs") |
4d337390 | 354 | (message "%d pure bytes used" pure-bytes-used) |
0d20f9a0 | 355 | ;; Recompute NAME now, so that it isn't set when we dump. |
fc46d219 SM |
356 | (if (not (or (memq system-type '(ms-dos windows-nt cygwin)) |
357 | ;; Don't bother adding another name if we're just | |
358 | ;; building bootstrap-emacs. | |
359 | (equal (nth 3 command-line-args) "bootstrap") | |
360 | (equal (nth 4 command-line-args) "bootstrap"))) | |
ed10e0ab RS |
361 | (let ((name (concat "emacs-" emacs-version))) |
362 | (while (string-match "[^-+_.a-zA-Z0-9]+" name) | |
363 | (setq name (concat (downcase (substring name 0 (match-beginning 0))) | |
364 | "-" | |
365 | (substring name (match-end 0))))) | |
fc46d219 | 366 | (message "Adding name %s" name) |
ed10e0ab | 367 | (add-name-to-file "emacs" name t))) |
0d20f9a0 JB |
368 | (kill-emacs))) |
369 | ||
370 | ;; Avoid error if user loads some more libraries now. | |
371 | (setq purify-flag nil) | |
372 | ||
373 | ;; For machines with CANNOT_DUMP defined in config.h, | |
374 | ;; this file must be loaded each time Emacs is run. | |
7fa26c0a | 375 | ;; So run the startup code now. First, remove `-l loadup' from args. |
0d20f9a0 | 376 | |
7fa26c0a KH |
377 | (if (and (equal (nth 1 command-line-args) "-l") |
378 | (equal (nth 2 command-line-args) "loadup")) | |
379 | (setcdr command-line-args (nthcdr 3 command-line-args))) | |
380 | ||
381 | (eval top-level) | |
6594deb0 | 382 | |
86db31d5 | 383 | \f |
6e6c6aaf SM |
384 | ;; Local Variables: |
385 | ;; no-byte-compile: t | |
386 | ;; no-update-autoloads: t | |
387 | ;; End: | |
6b61353c | 388 | |
6e6c6aaf | 389 | ;; arch-tag: 121e1dd4-36e1-45ac-860e-239f577a6335 |
6594deb0 | 390 | ;;; loadup.el ends here |