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