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