267
|
1 ;; loadup.el --- load up standardly loaded Lisp files for XEmacs.
|
209
|
2
|
223
|
3 ;; Copyright (C) 1985, 1986, 1992, 1994, 1997 Free Software Foundation, Inc.
|
209
|
4 ;; Copyright (C) 1996 Richard Mlynarik.
|
|
5 ;; Copyright (C) 1995, 1996 Ben Wing.
|
|
6
|
223
|
7 ;; Maintainer: XEmacs Development Team
|
|
8 ;; Keywords: internal, dumped
|
209
|
9
|
|
10 ;; This file is part of XEmacs.
|
|
11
|
|
12 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
13 ;; under the terms of the GNU General Public License as published by
|
|
14 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
15 ;; any later version.
|
|
16
|
|
17 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
20 ;; General Public License for more details.
|
|
21
|
|
22 ;; You should have received a copy of the GNU General Public License
|
|
23 ;; along with XEmacs; see the file COPYING. If not, write to the Free
|
|
24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
25 ;; 02111-1307, USA.
|
|
26
|
|
27 ;;; Synched up with: Last synched with FSF 19.30, with wild divergence since.
|
|
28
|
|
29 ;;; Commentary:
|
|
30
|
276
|
31 ;; Please do not edit this file. Use site-init.el or site-load.el instead.
|
223
|
32
|
|
33 ;; This is loaded into a bare XEmacs to make a dumpable one.
|
209
|
34
|
|
35 ;;; Code:
|
|
36
|
380
|
37 (when (fboundp 'error)
|
|
38 (error "loadup.el already loaded!"))
|
209
|
39
|
|
40 (defvar running-xemacs t
|
247
|
41 "Non-nil when the current emacs is XEmacs.")
|
209
|
42 (defvar preloaded-file-list nil
|
|
43 "List of files preloaded into the XEmacs binary image.")
|
|
44
|
398
|
45 (defvar Installation-string nil
|
|
46 "Description of XEmacs installation.")
|
380
|
47
|
|
48 (let ((gc-cons-threshold 30000))
|
|
49
|
227
|
50 ;; This is awfully damn early to be getting an error, right?
|
|
51 (call-with-condition-handler 'really-early-error-handler
|
|
52 #'(lambda ()
|
398
|
53
|
|
54 ;; Initialize Installation-string. We do it before loading
|
|
55 ;; anything so that dumped code can make use of its value.
|
|
56 (setq Installation-string
|
|
57 (save-current-buffer
|
|
58 (set-buffer (get-buffer-create (generate-new-buffer-name
|
|
59 " *temp*")))
|
|
60 ;; insert-file-contents-internal bogusly calls
|
|
61 ;; format-decode without checking if it's defined.
|
|
62 (fset 'format-decode #'(lambda (f l &optional v) l))
|
|
63 (insert-file-contents-internal "../Installation")
|
|
64 (fmakunbound 'format-decode)
|
|
65 (prog1 (buffer-substring)
|
|
66 (kill-buffer (current-buffer)))))
|
|
67
|
402
|
68 (let ((build-root (expand-file-name ".." invocation-directory)))
|
|
69 (setq load-path (list (expand-file-name "lisp" build-root)))
|
|
70 (setq module-load-path (list (expand-file-name "modules" build-root))))
|
267
|
71
|
398
|
72 ;; message not defined yet ...
|
227
|
73 (external-debugging-output (format "\nUsing load-path %s" load-path))
|
398
|
74 (external-debugging-output (format "\nUsing module-load-path %s"
|
|
75 module-load-path))
|
209
|
76
|
227
|
77 ;; We don't want to have any undo records in the dumped XEmacs.
|
|
78 (buffer-disable-undo (get-buffer "*scratch*"))
|
209
|
79
|
304
|
80 ;; Load our first bootstrap support
|
|
81 (load "very-early-lisp" nil t)
|
|
82
|
227
|
83 ;; lread.c (or src/Makefile.in.in) has prepended
|
|
84 ;; "${srcdir}/../lisp/" to load-path, which is how this file
|
|
85 ;; has been found. At this point, enough of XEmacs has been
|
|
86 ;; initialized that we can start dumping "standard" lisp.
|
|
87 ;; Dumped lisp from external packages is added when we search
|
274
|
88 ;; the package path.
|
227
|
89 ;; #### This code is duplicated in two other places.
|
|
90 (let ((temp-path (expand-file-name "." (car load-path))))
|
|
91 (setq load-path (nconc (mapcar
|
|
92 #'(lambda (i) (concat i "/"))
|
|
93 (directory-files temp-path t "^[^-.]"
|
|
94 nil 'dirs-only))
|
|
95 (cons (file-name-as-directory temp-path)
|
|
96 load-path))))
|
209
|
97
|
227
|
98 (setq load-warn-when-source-newer t ; Used to be set to nil at the end
|
|
99 load-warn-when-source-only t) ; Set to nil at the end
|
209
|
100
|
227
|
101 ;; garbage collect after loading every file in an attempt to
|
|
102 ;; minimize the size of the dumped image (if we don't do this,
|
|
103 ;; there will be lots of extra space in the data segment filled
|
|
104 ;; with garbage-collected junk)
|
267
|
105 (defun pureload (file)
|
380
|
106 (let ((full-path
|
|
107 (locate-file file load-path
|
398
|
108 (if load-ignore-elc-files
|
|
109 '(".el" "") '(".elc" ".el" "")))))
|
243
|
110 (if full-path
|
|
111 (prog1
|
|
112 (load full-path)
|
274
|
113 (garbage-collect))
|
243
|
114 (external-debugging-output (format "\nLoad file %s: not found\n"
|
|
115 file))
|
272
|
116 ;; Uncomment in case of trouble
|
|
117 ;;(print (format "late-packages: %S" late-packages))
|
|
118 ;;(print (format "guessed-roots: %S" (paths-find-emacs-roots invocation-directory invocation-name)))
|
243
|
119 nil)))
|
209
|
120
|
398
|
121 (load (expand-file-name "../lisp/dumped-lisp.el"))
|
267
|
122
|
276
|
123 (let ((files preloaded-file-list)
|
227
|
124 file)
|
276
|
125 (while (setq file (car files))
|
380
|
126 (unless (pureload file)
|
|
127 (external-debugging-output "Fatal error during load, aborting")
|
|
128 (kill-emacs 1))
|
276
|
129 (setq files (cdr files)))
|
380
|
130 (when (not (featurep 'toolbar))
|
|
131 ;; else still define a few functions.
|
|
132 (defun toolbar-button-p (obj) "No toolbar support." nil)
|
|
133 (defun toolbar-specifier-p (obj) "No toolbar support." nil))
|
267
|
134 (fmakunbound 'pureload))
|
|
135
|
276
|
136 (packages-load-package-dumped-lisps late-package-load-path)
|
267
|
137
|
227
|
138 )) ;; end of call-with-condition-handler
|
209
|
139
|
|
140 ;; Fix up the preloaded file list
|
|
141 (setq preloaded-file-list (mapcar #'file-name-sans-extension
|
|
142 preloaded-file-list))
|
|
143
|
|
144 (setq load-warn-when-source-newer t ; set to t at top of file
|
|
145 load-warn-when-source-only nil)
|
|
146
|
|
147 (setq debugger 'debug)
|
|
148
|
|
149 (when (member "no-site-file" command-line-args)
|
|
150 (setq site-start-file nil))
|
|
151
|
|
152 ;; If you want additional libraries to be preloaded and their
|
|
153 ;; doc strings kept in the DOC file rather than in core,
|
|
154 ;; you may load them with a "site-load.el" file.
|
|
155 ;; But you must also cause them to be scanned when the DOC file
|
|
156 ;; is generated. For VMS, you must edit ../../vms/makedoc.com.
|
|
157 ;; For other systems, you must edit ../../src/Makefile.in.in.
|
380
|
158 (when (load "site-load" t)
|
|
159 (garbage-collect))
|
209
|
160
|
|
161 ;;FSFmacs randomness
|
|
162 ;;(if (fboundp 'x-popup-menu)
|
|
163 ;; (precompute-menubar-bindings))
|
|
164 ;;; Turn on recording of which commands get rebound,
|
|
165 ;;; for the sake of the next call to precompute-menubar-bindings.
|
|
166 ;(setq define-key-rebound-commands nil)
|
|
167
|
|
168 ;; Note: all compiled Lisp files loaded above this point
|
|
169 ;; must be among the ones parsed by make-docfile
|
|
170 ;; to construct DOC. Any that are not processed
|
|
171 ;; for DOC will not have doc strings in the dumped XEmacs.
|
|
172
|
|
173 ;; Don't bother with these if we're running temacs, i.e. if we're
|
|
174 ;; just debugging don't waste time finding doc strings.
|
|
175
|
|
176 ;; purify-flag is nil if called from loadup-el.el.
|
|
177 (when purify-flag
|
|
178 (message "Finding pointers to doc strings...")
|
|
179 (Snarf-documentation "DOC")
|
|
180 (message "Finding pointers to doc strings...done")
|
380
|
181 (Verify-documentation))
|
209
|
182
|
|
183 ;; Note: You can cause additional libraries to be preloaded
|
|
184 ;; by writing a site-init.el that loads them.
|
|
185 ;; See also "site-load" above.
|
380
|
186 (when (stringp site-start-file)
|
|
187 (load "site-init" t))
|
209
|
188 (setq current-load-list nil)
|
|
189 (garbage-collect)
|
|
190
|
|
191 ;;; At this point, we're ready to resume undo recording for scratch.
|
|
192 (buffer-enable-undo "*scratch*")
|
|
193
|
380
|
194 ) ;; frequent garbage collection
|
|
195
|
209
|
196 ;; Dump into the name `xemacs' (only)
|
|
197 (when (member "dump" command-line-args)
|
380
|
198 (message "Dumping under the name xemacs")
|
|
199 ;; This is handled earlier in the build process.
|
|
200 ;; (condition-case () (delete-file "xemacs") (file-error nil))
|
|
201 (when (fboundp 'really-free)
|
|
202 (really-free))
|
|
203 (dump-emacs (if (featurep 'infodock) "infodock" "xemacs") "temacs")
|
|
204 (kill-emacs))
|
209
|
205
|
373
|
206 ;; Avoid error if user loads some more libraries now.
|
|
207 (setq purify-flag nil)
|
|
208
|
209
|
209 (when (member "run-temacs" command-line-args)
|
|
210 (message "\nBootstrapping from temacs...")
|
|
211 ;; Remove all args up to and including "run-temacs"
|
|
212 (apply #'run-emacs-from-temacs (cdr (member "run-temacs" command-line-args)))
|
|
213 ;; run-emacs-from-temacs doesn't actually return anyway.
|
|
214 (kill-emacs))
|
|
215
|
|
216 ;; XEmacs change
|
|
217 ;; If you are using 'recompile', then you should have used -l loadup-el.el
|
|
218 ;; so that the .el files always get loaded (the .elc files may be out-of-
|
|
219 ;; date or bad).
|
|
220 (when (member "recompile" command-line-args)
|
380
|
221 (setq command-line-args-left (cdr (member "recompile" command-line-args)))
|
|
222 (batch-byte-recompile-directory)
|
|
223 (kill-emacs))
|
209
|
224
|
|
225 ;; For machines with CANNOT_DUMP defined in config.h,
|
|
226 ;; this file must be loaded each time Emacs is run.
|
|
227 ;; So run the startup code now.
|
|
228
|
|
229 (when (not (fboundp 'dump-emacs))
|
|
230 ;; Avoid loading loadup.el a second time!
|
|
231 (setq command-line-args (cdr (cdr command-line-args)))
|
|
232 (eval top-level))
|
|
233
|
|
234 ;;; loadup.el ends here
|