Remove CVS merge cookie left in.
[emacs.git] / lisp / loadup.el
blobd97613f94b1c4f6f86aaafa94fddd99a279f65bf
1 ;;; loadup.el --- load up standardly loaded Lisp files for Emacs.
3 ;; Copyright (C) 1985, 1986, 1992, 1994 Free Software Foundation, Inc.
5 ;; Maintainer: FSF
6 ;; Keywords: internal
8 ;; This file is part of GNU Emacs.
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
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
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.
20 ;; You should have received a copy of the GNU General Public License
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.
25 ;;; Commentary:
27 ;; This is loaded into a bare Emacs to make a dumpable one.
29 ;;; Code:
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")
34 (equal (nth 4 command-line-args) "bootstrap"))
35 (let ((path (car load-path)))
36 (setq load-path (list path
37 (expand-file-name "emacs-lisp" path)
38 (expand-file-name "international" path)))))
40 (message "Using load-path %s" load-path)
42 ;;; We don't want to have any undo records in the dumped Emacs.
43 (buffer-disable-undo "*scratch*")
45 (load "byte-run")
46 (load "subr")
48 ;; We specify .el in case someone compiled version.el by mistake.
49 (load "version.el")
51 (load "widget")
52 (load "custom")
53 (autoload '\` "emacs-lisp/backquote" nil nil 'macro)
54 (load "map-ynp")
55 (load "env")
56 (load "cus-start")
57 (load "international/mule")
58 (load "international/mule-conf.el") ;Don't get confused if someone compiled this by mistake.
59 (load "format")
60 (load "bindings")
61 (setq load-source-file-function 'load-with-code-conversion)
62 (load "simple")
63 (load "files")
65 (message "Lists of integers (garbage collection statistics) are normal output")
66 (message "while building Emacs; they do not indicate a problem.")
67 (message "%s" (garbage-collect))
68 (load "loaddefs.el") ;Don't get confused if someone compiled this by mistake.
69 (message "%s" (garbage-collect))
71 (load "help")
72 ;; Any Emacs Lisp source file (*.el) loaded here after can contain
73 ;; multilingual text.
74 (load "international/mule-cmds")
75 (load "case-table")
76 (load "international/characters")
78 (let ((set-case-syntax-set-multibyte t))
79 (load "international/latin-1")
80 (load "international/latin-2")
81 (load "international/latin-3")
82 (load "international/latin-4")
83 (load "international/latin-5")
84 (load "international/latin-8")
85 (load "international/latin-9"))
86 ;; Load language-specific files.
87 (load "language/chinese")
88 (load "language/cyrillic")
89 (load "language/indian")
90 (load "language/devanagari") ; This should be loaded after indian.
91 (load "language/english")
92 (load "language/ethiopic")
93 (load "language/european")
94 (load "language/czech")
95 (load "language/slovak")
96 (load "language/romanian")
97 (load "language/greek")
98 (load "language/hebrew")
99 (load "language/japanese")
100 (load "language/korean")
101 (load "language/lao")
102 (load "language/thai")
103 (load "language/tibetan")
104 (load "language/vietnamese")
105 (load "language/misc-lang")
106 (update-coding-systems-internal)
108 (load "indent")
109 (load "window")
110 (load "frame")
111 (load "term/tty-colors")
112 (load "faces")
113 (if (fboundp 'frame-face-alist)
114 (progn
115 (load "facemenu")))
116 (if (fboundp 'track-mouse)
117 (progn
118 (load "mouse")
119 (and (boundp 'x-toolkit-scroll-bars-p)
120 (load "scroll-bar"))
121 (load "select")))
122 (load "isearch")
124 (message "%s" (garbage-collect))
125 (load "menu-bar")
126 (load "paths.el") ;Don't get confused if someone compiled paths by mistake.
127 (load "startup")
128 (load "emacs-lisp/lisp")
129 (load "textmodes/page")
130 (load "register")
131 (load "textmodes/paragraphs")
132 (load "emacs-lisp/lisp-mode")
133 (load "textmodes/text-mode")
134 (load "textmodes/fill")
135 (message "%s" (garbage-collect))
137 (load "replace")
138 (if (eq system-type 'vax-vms)
139 (progn
140 (load "vmsproc")))
141 (load "abbrev")
142 (load "buff-menu")
143 (if (eq system-type 'vax-vms)
144 (progn
145 (load "vms-patch")))
146 (if (eq system-type 'windows-nt)
147 (progn
148 (load "ls-lisp")
149 (load "disp-table") ; needed to setup ibm-pc char set, see internal.el
150 (load "dos-w32")
151 (load "w32-fns")))
152 (if (eq system-type 'ms-dos)
153 (progn
154 (load "ls-lisp")
155 (load "dos-w32")
156 (load "dos-fns")
157 (load "dos-vars")
158 (load "international/ccl") ; for cpNNN coding systems in codepage.el
159 (load "international/codepage") ; internal.el uses cpNNN coding systems
160 (load "disp-table"))) ; needed to setup ibm-pc char set, see internal.el
161 (if (fboundp 'atan) ; preload some constants and
162 (progn ; floating pt. functions if we have float support.
163 (load "float-sup")))
164 (message "%s" (garbage-collect))
166 (load "vc-hooks")
167 (load "ediff-hook")
168 (message "%s" (garbage-collect))
170 ;If you want additional libraries to be preloaded and their
171 ;doc strings kept in the DOC file rather than in core,
172 ;you may load them with a "site-load.el" file.
173 ;But you must also cause them to be scanned when the DOC file
174 ;is generated. For VMS, you must edit ../vms/makedoc.com.
175 ;For other systems, you must edit ../src/Makefile.in.
176 (if (load "site-load" t)
177 (garbage-collect))
179 (if (fboundp 'x-popup-menu)
180 (precompute-menubar-bindings))
181 ;; Turn on recording of which commands get rebound,
182 ;; for the sake of the next call to precompute-menubar-bindings.
183 (setq define-key-rebound-commands nil)
185 ;; Determine which last version number to use
186 ;; based on the executables that now exist.
187 (if (and (or (equal (nth 3 command-line-args) "dump")
188 (equal (nth 4 command-line-args) "dump"))
189 (not (eq system-type 'ms-dos)))
190 (let* ((base (concat "emacs-" emacs-version "."))
191 (files (file-name-all-completions base default-directory))
192 (versions (mapcar (function (lambda (name)
193 (string-to-int (substring name (length base)))))
194 files)))
195 (setq emacs-version (format "%s.%d"
196 emacs-version
197 (if versions
198 (1+ (apply 'max versions))
199 1)))))
201 ;; Note: all compiled Lisp files loaded above this point
202 ;; must be among the ones parsed by make-docfile
203 ;; to construct DOC. Any that are not processed
204 ;; for DOC will not have doc strings in the dumped Emacs.
206 (message "Finding pointers to doc strings...")
207 (if (or (equal (nth 3 command-line-args) "dump")
208 (equal (nth 4 command-line-args) "dump"))
209 (let ((name emacs-version))
210 (while (string-match "[^-+_.a-zA-Z0-9]+" name)
211 (setq name (concat (downcase (substring name 0 (match-beginning 0)))
213 (substring name (match-end 0)))))
214 (if (memq system-type '(ms-dos windows-nt))
215 (setq name (expand-file-name
216 (if (fboundp 'x-create-frame) "DOC-X" "DOC") "../etc"))
217 (setq name (concat (expand-file-name "../etc/DOC-") name))
218 (if (file-exists-p name)
219 (delete-file name))
220 (copy-file (expand-file-name "../etc/DOC") name t))
221 (Snarf-documentation (file-name-nondirectory name)))
222 (condition-case nil
223 (Snarf-documentation "DOC")
224 (error nil)))
225 (message "Finding pointers to doc strings...done")
227 ;;;Note: You can cause additional libraries to be preloaded
228 ;;;by writing a site-init.el that loads them.
229 ;;;See also "site-load" above.
230 (load "site-init" t)
231 (setq current-load-list nil)
233 ;; Write the value of load-history into fns-VERSION.el,
234 ;; then clear out load-history.
235 (if (or (equal (nth 3 command-line-args) "dump")
236 (equal (nth 4 command-line-args) "dump"))
237 (let ((buffer-undo-list t))
238 (princ "(setq load-history\n" (current-buffer))
239 (princ " (nconc load-history\n" (current-buffer))
240 (princ " '(" (current-buffer))
241 (let ((tem load-history))
242 (while tem
243 (prin1 (car tem) (current-buffer))
244 (terpri (current-buffer))
245 (if (cdr tem)
246 (princ " " (current-buffer)))
247 (setq tem (cdr tem))))
248 (princ ")))\n" (current-buffer))
249 (write-region (point-min) (point-max)
250 (expand-file-name
251 (cond
252 ((eq system-type 'ms-dos)
253 "../lib-src/fns.el")
254 ((eq system-type 'windows-nt)
255 (format "../../../lib-src/fns-%s.el" emacs-version))
257 (format "../lib-src/fns-%s.el" emacs-version)))
258 invocation-directory))
259 (erase-buffer)
260 (setq load-history nil))
261 (setq symbol-file-load-history-loaded t))
262 (set-buffer-modified-p nil)
264 ;; reset the load-path. See lread.c:init_lread why.
265 (if (or (equal (nth 3 command-line-args) "bootstrap")
266 (equal (nth 4 command-line-args) "bootstrap"))
267 (setcdr load-path nil))
269 (garbage-collect)
271 ;;; At this point, we're ready to resume undo recording for scratch.
272 (buffer-enable-undo "*scratch*")
274 (if (or (member (nth 3 command-line-args) '("dump" "bootstrap"))
275 (member (nth 4 command-line-args) '("dump" "bootstrap")))
276 (if (eq system-type 'vax-vms)
277 (progn
278 (message "Dumping data as file temacs.dump")
279 (dump-emacs "temacs.dump" "temacs")
280 (kill-emacs))
281 (let ((name (concat "emacs-" emacs-version)))
282 (while (string-match "[^-+_.a-zA-Z0-9]+" name)
283 (setq name (concat (downcase (substring name 0 (match-beginning 0)))
285 (substring name (match-end 0)))))
286 (if (eq system-type 'ms-dos)
287 (message "Dumping under the name emacs")
288 (message "Dumping under names emacs and %s" name)))
289 (condition-case ()
290 (delete-file "emacs")
291 (file-error nil))
292 ;; We used to dump under the name xemacs, but that occasionally
293 ;; confused people installing Emacs (they'd install the file
294 ;; under the name `xemacs'), and it's inconsistent with every
295 ;; other GNU program's build process.
296 (dump-emacs "emacs" "temacs")
297 (message "%d pure bytes used" pure-bytes-used)
298 ;; Recompute NAME now, so that it isn't set when we dump.
299 (if (not (memq system-type '(ms-dos windows-nt)))
300 (let ((name (concat "emacs-" emacs-version)))
301 (while (string-match "[^-+_.a-zA-Z0-9]+" name)
302 (setq name (concat (downcase (substring name 0 (match-beginning 0)))
304 (substring name (match-end 0)))))
305 (add-name-to-file "emacs" name t)))
306 (kill-emacs)))
308 ;; Avoid error if user loads some more libraries now.
309 (setq purify-flag nil)
311 ;; For machines with CANNOT_DUMP defined in config.h,
312 ;; this file must be loaded each time Emacs is run.
313 ;; So run the startup code now. First, remove `-l loadup' from args.
315 (if (and (equal (nth 1 command-line-args) "-l")
316 (equal (nth 2 command-line-args) "loadup"))
317 (setcdr command-line-args (nthcdr 3 command-line-args)))
319 (eval top-level)
321 ;;; loadup.el ends here