0
|
1 ;;; loadup.el --- load up standardly loaded Lisp files for XEmacs.
|
|
2
|
|
3 ;; It is not a good idea to edit this file. Use site-init.el or site-load.el
|
|
4 ;; instead.
|
|
5 ;;
|
|
6 ;; Copyright (C) 1985, 1986, 1992, 1993, 1994 Free Software Foundation, Inc.
|
|
7 ;; Copyright (C) 1996 Richard Mlynarik.
|
|
8 ;; Copyright (C) 1995, 1996 Ben Wing.
|
|
9
|
|
10 ;; Maintainer: FSF
|
|
11 ;; Keywords: internal
|
|
12
|
|
13 ;; This file is part of XEmacs.
|
|
14
|
|
15 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
16 ;; under the terms of the GNU General Public License as published by
|
|
17 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
18 ;; any later version.
|
|
19
|
|
20 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
21 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
23 ;; General Public License for more details.
|
|
24
|
|
25 ;; You should have received a copy of the GNU General Public License
|
|
26 ;; along with XEmacs; see the file COPYING. If not, write to the Free
|
|
27 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
28
|
|
29 ;;; Synched up with: FSF 19.30.
|
|
30
|
|
31 ;;; Commentary:
|
|
32
|
|
33 ;; This is loaded into a bare Emacs to make a dumpable one.
|
|
34
|
|
35 ;;; Code:
|
|
36
|
|
37 (if (fboundp 'error)
|
|
38 (error "loadup.el already loaded!"))
|
|
39
|
|
40 (define-function 'defalias 'define-function)
|
|
41
|
|
42 (call-with-condition-handler
|
|
43 ;; This is awfully damn early to be getting an error, right?
|
|
44 'really-early-error-handler
|
|
45 #'(lambda ()
|
|
46 ; message not defined yet ...
|
|
47 (external-debugging-output (format "\nUsing load-path %s" load-path))
|
|
48
|
|
49 ;; We don't want to have any undo records in the dumped XEmacs.
|
|
50 (buffer-disable-undo (get-buffer "*scratch*"))
|
|
51
|
|
52 ;; lread.c (or src/Makefile.in.in) has prepended "${srcdir}/../lisp/prim"
|
|
53 ;; to load-path, which is how this file has been found. At this point,
|
|
54 ;; enough of emacs has been initialized that we can call directory-files
|
|
55 ;; and get the rest of the dirs (so that we can dump stuff from modes/
|
|
56 ;; and packages/.)
|
|
57 ;;
|
|
58 (let ((temp-path (expand-file-name ".." (car load-path))))
|
|
59 (setq source-directory temp-path)
|
|
60 (setq load-path (nconc (directory-files temp-path t "^[^-.]"
|
|
61 nil 'dirs-only)
|
|
62 (cons temp-path load-path))))
|
|
63
|
|
64 (setq load-warn-when-source-newer t ; set to nil at the end
|
|
65 load-warn-when-source-only t)
|
|
66
|
|
67 (let ((l #'(lambda (x)
|
|
68 (load x)
|
|
69 ;; garbage collect after loading every file in an attempt to
|
|
70 ;; minimize the size of the dumped image (if we don't do
|
|
71 ;; this, there will be lots of extra space in the data
|
|
72 ;; segment filled with garbage-collected junk)
|
|
73 (garbage-collect))))
|
|
74 (funcall l "backquote") ; needed for defsubst etc.
|
|
75 (funcall l "bytecomp-runtime") ; define defsubst
|
|
76 (funcall l "subr") ;; now load the most basic Lisp functions
|
|
77 (funcall l "replace") ;; match-string used in version.el.
|
|
78 (funcall l "version.el") ;Ignore compiled-by-mistake version.elc
|
|
79 (funcall l "cl")
|
|
80 (funcall l "cmdloop")
|
|
81 (or (fboundp 'recursive-edit) (funcall l "cmdloop1"))
|
|
82 (funcall l "keymap")
|
|
83 (funcall l "syntax")
|
|
84 (funcall l "device")
|
|
85 (funcall l "console")
|
|
86 (funcall l "obsolete")
|
|
87 (funcall l "specifier")
|
|
88 (funcall l "faces") ; must be loaded before any make-face call
|
|
89 ;(funcall l "facemenu") #### not yet ported
|
|
90 (funcall l "glyphs")
|
|
91 (funcall l "objects")
|
|
92 (funcall l "extents")
|
|
93 (funcall l "events")
|
|
94 (funcall l "text-props")
|
|
95 (funcall l "process")
|
|
96 (funcall l "frame") ; move up here cause some stuff needs it here
|
|
97 (funcall l "map-ynp")
|
|
98 (funcall l "simple")
|
|
99 (funcall l "keydefs") ; Before loaddefs so that keymap vars exist.
|
|
100 (funcall l "abbrev")
|
|
101 (funcall l "derived")
|
|
102 (funcall l "minibuf")
|
|
103 (funcall l "list-mode")
|
|
104 (funcall l "modeline") ;after simple.el so it can reference functions
|
|
105 ;defined there.
|
|
106 ;; If SparcWorks support is included some additional packages are
|
|
107 ;; dumped which would normally have autoloads. To avoid
|
|
108 ;; duplicate doc string warnings, SparcWorks uses a separate
|
|
109 ;; autoloads file with the dumped packages removed.
|
|
110 (if (featurep 'sparcworks)
|
|
111 (funcall l "eos/loaddefs-eos")
|
|
112 (funcall l "loaddefs"))
|
|
113 (funcall l "misc")
|
|
114 (funcall l "profile")
|
|
115 (funcall l "help")
|
|
116 ;; (funcall l "hyper-apropos") Soon...
|
|
117 (funcall l "files")
|
|
118 (funcall l "lib-complete")
|
|
119 (funcall l "format")
|
|
120 (funcall l "indent")
|
|
121 (funcall l "isearch-mode")
|
|
122 (funcall l "buffer")
|
|
123 (funcall l "buff-menu")
|
|
124 (funcall l "undo-stack")
|
|
125 (funcall l "window")
|
|
126 (funcall l "paths.el") ; don't get confused if paths compiled.
|
|
127 (funcall l "startup")
|
|
128 (funcall l "lisp")
|
|
129 (funcall l "page")
|
|
130 (funcall l "register")
|
|
131 (funcall l "iso8859-1") ; This must be before any modes
|
|
132 ; (sets standard syntax table.)
|
|
133 (funcall l "paragraphs")
|
|
134 (funcall l "lisp-mode")
|
|
135 (funcall l "text-mode")
|
|
136 (funcall l "fill")
|
|
137 (funcall l "cc-mode")
|
|
138 (if (eq system-type 'vax-vms)
|
|
139 (funcall l "vmsproc"))
|
|
140 (if (eq system-type 'vax-vms)
|
|
141 (funcall l "vms-patch"))
|
|
142 (if (eq system-type 'windows-nt)
|
|
143 (progn
|
|
144 (funcall l "ls-lisp")
|
|
145 (funcall l "winnt")))
|
|
146 (if (eq system-type 'ms-dos)
|
|
147 (progn
|
|
148 (funcall l "ls-lisp")
|
|
149 (funcall l "dos-fns")
|
|
150 (funcall l "disp-table") ; needed to setup ibm-pc char set,
|
|
151 ; see internal.el
|
|
152 ))
|
|
153 (if (featurep 'lisp-float-type)
|
|
154 (funcall l "float-sup"))
|
|
155 (funcall l "itimer") ; for vars auto-save-timeout and auto-gc-threshold
|
|
156 (if (featurep 'toolbar)
|
|
157 (funcall l "toolbar")
|
|
158 (progn
|
|
159 ;; but still define a few functions.
|
|
160 (defun toolbar-button-p (obj) "No toolbar support." nil)
|
|
161 (defun toolbar-specifier-p (obj) "No toolbar support." nil)))
|
|
162 (if (featurep 'scrollbar)
|
|
163 (funcall l "scrollbar"))
|
|
164 (if (featurep 'menubar)
|
|
165 (funcall l "menubar"))
|
|
166 (if (featurep 'dialog)
|
|
167 (funcall l "dialog"))
|
|
168 (if (featurep 'window-system)
|
|
169 (progn
|
|
170 (funcall l "gui")
|
|
171 (funcall l "mode-motion")
|
|
172 (funcall l "mouse")))
|
|
173 (if (featurep 'x)
|
|
174 ;; preload the X code, for faster startup.
|
|
175 (progn
|
|
176 (if (featurep 'menubar)
|
|
177 (progn
|
|
178 (funcall l "x-menubar")
|
|
179 ;; autoload this.
|
|
180 ;;(funcall l "x-font-menu")
|
|
181 ))
|
|
182 (funcall l "x-faces")
|
|
183 (funcall l "x-iso8859-1")
|
|
184 (funcall l "x-mouse")
|
|
185 (funcall l "x-select")
|
|
186 (if (featurep 'scrollbar)
|
|
187 (funcall l "x-scrollbar"))
|
|
188 (funcall l "x-misc")
|
|
189 (funcall l "x-init")
|
|
190 (if (featurep 'toolbar)
|
|
191 (funcall l "x-toolbar"))
|
|
192 ))
|
|
193 (if (featurep 'tty)
|
|
194 ;; preload the TTY init code.
|
|
195 (funcall l "tty-init"))
|
|
196 (if (featurep 'tooltalk)
|
|
197 (funcall l "tooltalk/tooltalk-load"))
|
|
198 (funcall l "vc-hooks")
|
|
199 (funcall l "ediff-hook")
|
|
200 (funcall l "fontl-hooks")
|
|
201 (funcall l "auto-show")
|
|
202 (if (featurep 'energize)
|
|
203 (funcall l "energize/energize-load.el"))
|
|
204 (if (featurep 'sparcworks)
|
|
205 (funcall l "sunpro/sunpro-load.el"))
|
|
206 ))) ;; end of call-with-condition-handler
|
|
207
|
|
208
|
|
209 (setq load-warn-when-source-newer nil ; set to t at top of file
|
|
210 load-warn-when-source-only nil)
|
|
211
|
|
212 (setq debugger 'debug)
|
|
213
|
|
214 (if (or (equal (nth 4 command-line-args) "no-site-file")
|
|
215 (equal (nth 5 command-line-args) "no-site-file"))
|
|
216 (setq site-start-file nil))
|
|
217
|
|
218 ;;; If you want additional libraries to be preloaded and their
|
|
219 ;;; doc strings kept in the DOC file rather than in core,
|
|
220 ;;; you may load them with a "site-load.el" file.
|
|
221 ;;; But you must also cause them to be scanned when the DOC file
|
|
222 ;;; is generated. For VMS, you must edit ../../vms/makedoc.com.
|
|
223 ;;; For other systems, you must edit ../../src/Makefile.in.in.
|
|
224 (if (load "site-load" t)
|
|
225 (garbage-collect))
|
|
226
|
|
227 ;FSFmacs randomness
|
|
228 ;(if (fboundp 'x-popup-menu)
|
|
229 ; (precompute-menubar-bindings))
|
|
230 ;;; Turn on recording of which commands get rebound,
|
|
231 ;;; for the sake of the next call to precompute-menubar-bindings.
|
|
232 ;(setq define-key-rebound-commands nil)
|
|
233
|
|
234 ;;FSFmacs #### what?
|
|
235 ;; Determine which last version number to use
|
|
236 ;; based on the executables that now exist.
|
|
237 ;(if (and (or (equal (nth 3 command-line-args) "dump")
|
|
238 ; (equal (nth 4 command-line-args) "dump"))
|
|
239 ; (not (eq system-type 'ms-dos)))
|
|
240 ; (let* ((base (concat "emacs-" emacs-version "."))
|
|
241 ; (files (file-name-all-completions base default-directory))
|
|
242 ; (versions (mapcar (function (lambda (name)
|
|
243 ; (string-to-int (substring name (length base)))))
|
|
244 ; files)))
|
|
245 ; (setq emacs-version (format "%s.%d"
|
|
246 ; emacs-version
|
|
247 ; (if versions
|
|
248 ; (1+ (apply 'max versions))
|
|
249 ; 1)))))
|
|
250
|
|
251 ;;; Note: all compiled Lisp files loaded above this point
|
|
252 ;;; must be among the ones parsed by make-docfile
|
|
253 ;;; to construct DOC. Any that are not processed
|
|
254 ;;; for DOC will not have doc strings in the dumped XEmacs.
|
|
255
|
|
256 ;;; Don't bother with these if we're running temacs, i.e. if we're
|
|
257 ;;; just debugging don't waste time finding doc strings.
|
|
258
|
|
259 (if (or (equal (nth 3 command-line-args) "dump")
|
|
260 (equal (nth 4 command-line-args) "dump"))
|
|
261 (progn
|
|
262 (message "Finding pointers to doc strings...")
|
|
263 (if (fboundp 'dump-emacs)
|
|
264 (let ((name emacs-version))
|
|
265 (string-match " Lucid" name)
|
|
266 (setq name (concat (substring name 0 (match-beginning 0))
|
|
267 (substring name (match-end 0))))
|
|
268 (while (string-match "[^-+_.a-zA-Z0-9]+" name)
|
|
269 (setq name (concat
|
|
270 (downcase (substring name 0 (match-beginning 0)))
|
|
271 "-"
|
|
272 (substring name (match-end 0)))))
|
|
273 (if (string-match "-+\\'" name)
|
|
274 (setq name (substring name 0 (match-beginning 0))))
|
|
275 (if (memq system-type '(ms-dos windows-nt))
|
|
276 (setq name (expand-file-name
|
|
277 (if (fboundp 'make-frame) "DOC-X" "DOC") "../etc"))
|
|
278 (setq name (concat (expand-file-name "DOC-" "../lib-src") name))
|
|
279 (if (file-exists-p name)
|
|
280 (delete-file name))
|
|
281 (copy-file (expand-file-name "DOC" "../lib-src") name t))
|
|
282 (Snarf-documentation (file-name-nondirectory name)))
|
|
283 (Snarf-documentation "DOC"))
|
|
284 (message "Finding pointers to doc strings...done")
|
|
285 (Verify-documentation)
|
|
286 ))
|
|
287
|
|
288 ;;; Note: You can cause additional libraries to be preloaded
|
|
289 ;;; by writing a site-init.el that loads them.
|
|
290 ;;; See also "site-load" above.
|
|
291 (if (stringp site-start-file)
|
|
292 (load "site-init" t))
|
|
293 (setq current-load-list nil)
|
|
294 (garbage-collect)
|
|
295
|
|
296 ;;; At this point, we're ready to resume undo recording for scratch.
|
|
297 (buffer-enable-undo "*scratch*")
|
|
298
|
|
299 (if (or (equal (nth 3 command-line-args) "dump")
|
|
300 (equal (nth 4 command-line-args) "dump"))
|
|
301 (if (eq system-type 'vax-vms)
|
|
302 (progn
|
|
303 (setq command-line-args nil)
|
|
304 (message "Dumping data as file temacs.dump")
|
|
305 (dump-emacs "temacs.dump" "temacs")
|
|
306 (kill-emacs))
|
|
307 (let ((name (concat "emacs-" emacs-version)))
|
|
308 (string-match " Lucid" name)
|
|
309 (setq name (concat (substring name 0 (match-beginning 0))
|
|
310 (substring name (match-end 0))))
|
|
311 (while (string-match "[^-+_.a-zA-Z0-9]+" name)
|
|
312 (setq name (concat (downcase (substring name 0 (match-beginning 0)))
|
|
313 "-"
|
|
314 (substring name (match-end 0)))))
|
|
315 (if (string-match "-+\\'" name)
|
|
316 (setq name (substring name 0 (match-beginning 0))))
|
|
317 (if (eq system-type 'ms-dos)
|
|
318 (message "Dumping under the name xemacs")
|
|
319 (message "Dumping under names xemacs and %s" name)))
|
|
320 (condition-case ()
|
|
321 (delete-file "xemacs")
|
|
322 (file-error nil))
|
|
323 (if (fboundp 'really-free)
|
|
324 (really-free))
|
|
325 ;; Note that FSF used to dump under `xemacs'!
|
|
326 (dump-emacs "xemacs" "temacs")
|
|
327 ;This is done automatically.
|
|
328 ;(message "%d pure bytes used" pure-bytes-used)
|
|
329 ;; Recompute NAME now, so that it isn't set when we dump.
|
|
330 (if (not (memq system-type '(ms-dos windows-nt)))
|
|
331 (let ((name (concat "emacs-" emacs-version)))
|
|
332 (string-match " Lucid" name)
|
|
333 (setq name (concat (substring name 0 (match-beginning 0))
|
|
334 (substring name (match-end 0))))
|
|
335 (while (string-match "[^-+_.a-zA-Z0-9]+" name)
|
|
336 (setq name (concat (downcase (substring name 0
|
|
337 (match-beginning 0)))
|
|
338 "-"
|
|
339 (substring name (match-end 0)))))
|
|
340 (if (string-match "-+\\'" name)
|
|
341 (setq name (substring name 0 (match-beginning 0))))
|
|
342 (add-name-to-file "xemacs" name t)))
|
|
343 (kill-emacs)))
|
|
344
|
|
345 (if (or (equal (nth 3 command-line-args) "run-temacs")
|
|
346 (equal (nth 4 command-line-args) "run-temacs"))
|
|
347 (progn
|
|
348 ;; purify-flag is nil if called from loadup-el.el.
|
|
349 (if purify-flag
|
|
350 (progn
|
|
351 (message "\nSnarfing doc...")
|
|
352 (Snarf-documentation "DOC")
|
|
353 (Verify-documentation)))
|
|
354 (message "\nBootstrapping from temacs...")
|
|
355 (setq purify-flag nil)
|
|
356 (apply #'run-emacs-from-temacs
|
|
357 (nthcdr (if (equal (nth 3 command-line-args) "run-temacs")
|
|
358 4 5)
|
|
359 command-line-args))
|
|
360 ;; run-emacs-from-temacs doesn't actually return anyway.
|
|
361 (kill-emacs)))
|
|
362
|
|
363 ;;; Avoid error if user loads some more libraries now.
|
|
364 (setq purify-flag nil)
|
|
365
|
|
366 ;;; If you are using 'recompile', then you should have used -l loadup-el.el
|
|
367 ;;; so that the .el files always get loaded (the .elc files may be out-of-
|
|
368 ;;; date or bad).
|
|
369 (if (or (equal (nth 3 command-line-args) "recompile")
|
|
370 (equal (nth 4 command-line-args) "recompile"))
|
|
371 (progn
|
|
372 (let ((command-line-args-left
|
|
373 (nthcdr (if (equal (nth 3 command-line-args) "recompile")
|
|
374 4 5)
|
|
375 command-line-args)))
|
|
376 (batch-byte-recompile-directory)
|
|
377 (kill-emacs))))
|
|
378
|
|
379
|
|
380 ;;; For machines with CANNOT_DUMP defined in config.h,
|
|
381 ;;; this file must be loaded each time XEmacs is run.
|
|
382 ;;; So run the startup code now.
|
|
383
|
|
384 ;; For machines with CANNOT_DUMP defined in config.h,
|
|
385 ;; this file must be loaded each time Emacs is run.
|
|
386 ;; So run the startup code now.
|
|
387
|
|
388 (or (fboundp 'dump-emacs)
|
|
389 (progn
|
|
390 ;; Avoid loading loadup.el a second time!
|
|
391 (setq command-line-args (cdr (cdr command-line-args)))
|
|
392 (eval top-level)))
|
|
393
|
|
394 ;;; loadup.el ends here
|