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