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
|
|
37 (if (fboundp 'error)
|
|
38 (error "loadup.el already loaded!"))
|
|
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
|
227
|
45 ;; This is awfully damn early to be getting an error, right?
|
|
46 (call-with-condition-handler 'really-early-error-handler
|
|
47 #'(lambda ()
|
|
48 ;; message not defined yet ...
|
284
|
49 (setq load-path (split-path (getenv "EMACSBOOTSTRAPLOADPATH")))
|
267
|
50
|
227
|
51 (external-debugging-output (format "\nUsing load-path %s" load-path))
|
209
|
52
|
227
|
53 ;; We don't want to have any undo records in the dumped XEmacs.
|
|
54 (buffer-disable-undo (get-buffer "*scratch*"))
|
209
|
55
|
304
|
56 ;; Load our first bootstrap support
|
|
57 (load "very-early-lisp" nil t)
|
|
58
|
227
|
59 ;; lread.c (or src/Makefile.in.in) has prepended
|
|
60 ;; "${srcdir}/../lisp/" to load-path, which is how this file
|
|
61 ;; has been found. At this point, enough of XEmacs has been
|
|
62 ;; initialized that we can start dumping "standard" lisp.
|
|
63 ;; Dumped lisp from external packages is added when we search
|
274
|
64 ;; the package path.
|
227
|
65 ;; #### This code is duplicated in two other places.
|
|
66 (let ((temp-path (expand-file-name "." (car load-path))))
|
|
67 (setq load-path (nconc (mapcar
|
|
68 #'(lambda (i) (concat i "/"))
|
|
69 (directory-files temp-path t "^[^-.]"
|
|
70 nil 'dirs-only))
|
|
71 (cons (file-name-as-directory temp-path)
|
|
72 load-path))))
|
209
|
73
|
227
|
74 (setq load-warn-when-source-newer t ; Used to be set to nil at the end
|
|
75 load-warn-when-source-only t) ; Set to nil at the end
|
209
|
76
|
227
|
77 ;; garbage collect after loading every file in an attempt to
|
|
78 ;; minimize the size of the dumped image (if we don't do this,
|
|
79 ;; there will be lots of extra space in the data segment filled
|
|
80 ;; with garbage-collected junk)
|
267
|
81 (defun pureload (file)
|
243
|
82 (let ((full-path (locate-file file
|
|
83 load-path
|
|
84 (if load-ignore-elc-files
|
|
85 ".el:"
|
|
86 ".elc:.el:"))))
|
|
87 (if full-path
|
|
88 (prog1
|
|
89 (load full-path)
|
274
|
90 (garbage-collect))
|
243
|
91 (external-debugging-output (format "\nLoad file %s: not found\n"
|
|
92 file))
|
272
|
93 ;; Uncomment in case of trouble
|
|
94 ;;(print (format "late-packages: %S" late-packages))
|
|
95 ;;(print (format "guessed-roots: %S" (paths-find-emacs-roots invocation-directory invocation-name)))
|
243
|
96 nil)))
|
209
|
97
|
227
|
98 (load (concat default-directory "../lisp/dumped-lisp.el"))
|
267
|
99
|
276
|
100 (let ((files preloaded-file-list)
|
227
|
101 file)
|
276
|
102 (while (setq file (car files))
|
267
|
103 (or (pureload file)
|
243
|
104 (progn
|
|
105 (external-debugging-output "Fatal error during load, aborting")
|
|
106 (kill-emacs 1)))
|
276
|
107 (setq files (cdr files)))
|
227
|
108 (if (not (featurep 'toolbar))
|
|
109 (progn
|
|
110 ;; else still define a few functions.
|
|
111 (defun toolbar-button-p (obj) "No toolbar support." nil)
|
|
112 (defun toolbar-specifier-p (obj) "No toolbar support." nil)))
|
267
|
113 (fmakunbound 'pureload))
|
|
114
|
276
|
115 (packages-load-package-dumped-lisps late-package-load-path)
|
267
|
116
|
227
|
117 )) ;; end of call-with-condition-handler
|
209
|
118
|
|
119 ;; Fix up the preloaded file list
|
|
120 (setq preloaded-file-list (mapcar #'file-name-sans-extension
|
|
121 preloaded-file-list))
|
|
122
|
|
123 (setq load-warn-when-source-newer t ; set to t at top of file
|
|
124 load-warn-when-source-only nil)
|
|
125
|
|
126 (setq debugger 'debug)
|
|
127
|
|
128 (when (member "no-site-file" command-line-args)
|
|
129 (setq site-start-file nil))
|
|
130
|
|
131 ;; If you want additional libraries to be preloaded and their
|
|
132 ;; doc strings kept in the DOC file rather than in core,
|
|
133 ;; you may load them with a "site-load.el" file.
|
|
134 ;; But you must also cause them to be scanned when the DOC file
|
|
135 ;; is generated. For VMS, you must edit ../../vms/makedoc.com.
|
|
136 ;; For other systems, you must edit ../../src/Makefile.in.in.
|
|
137 (if (load "site-load" t)
|
|
138 (garbage-collect))
|
|
139
|
|
140 ;;FSFmacs randomness
|
|
141 ;;(if (fboundp 'x-popup-menu)
|
|
142 ;; (precompute-menubar-bindings))
|
|
143 ;;; Turn on recording of which commands get rebound,
|
|
144 ;;; for the sake of the next call to precompute-menubar-bindings.
|
|
145 ;(setq define-key-rebound-commands nil)
|
|
146
|
|
147
|
|
148 ;; Note: all compiled Lisp files loaded above this point
|
|
149 ;; must be among the ones parsed by make-docfile
|
|
150 ;; to construct DOC. Any that are not processed
|
|
151 ;; for DOC will not have doc strings in the dumped XEmacs.
|
|
152
|
|
153 ;; Don't bother with these if we're running temacs, i.e. if we're
|
|
154 ;; just debugging don't waste time finding doc strings.
|
|
155
|
|
156 ;; purify-flag is nil if called from loadup-el.el.
|
|
157 (when purify-flag
|
|
158 (message "Finding pointers to doc strings...")
|
|
159 (Snarf-documentation "DOC")
|
|
160 (message "Finding pointers to doc strings...done")
|
|
161 (Verify-documentation)
|
|
162 )
|
|
163
|
|
164 ;; Note: You can cause additional libraries to be preloaded
|
|
165 ;; by writing a site-init.el that loads them.
|
|
166 ;; See also "site-load" above.
|
|
167 (if (stringp site-start-file)
|
|
168 (load "site-init" t))
|
|
169 (setq current-load-list nil)
|
|
170 (garbage-collect)
|
|
171
|
|
172 ;;; At this point, we're ready to resume undo recording for scratch.
|
|
173 (buffer-enable-undo "*scratch*")
|
|
174
|
|
175 ;; Dump into the name `xemacs' (only)
|
|
176 (when (member "dump" command-line-args)
|
|
177 (message "Dumping under the name xemacs")
|
247
|
178 ;; This is handled earlier in the build process.
|
|
179 ;; (condition-case () (delete-file "xemacs") (file-error nil))
|
249
|
180 (when (fboundp 'really-free)
|
|
181 (really-free))
|
280
|
182 (dump-emacs (if (featurep 'infodock) "infodock" "xemacs") "temacs")
|
249
|
183 (kill-emacs))
|
209
|
184
|
373
|
185 ;; Avoid error if user loads some more libraries now.
|
|
186 (setq purify-flag nil)
|
|
187
|
209
|
188 (when (member "run-temacs" command-line-args)
|
|
189 (message "\nBootstrapping from temacs...")
|
|
190 ;; Remove all args up to and including "run-temacs"
|
|
191 (apply #'run-emacs-from-temacs (cdr (member "run-temacs" command-line-args)))
|
|
192 ;; run-emacs-from-temacs doesn't actually return anyway.
|
|
193 (kill-emacs))
|
|
194
|
|
195 ;; XEmacs change
|
|
196 ;; If you are using 'recompile', then you should have used -l loadup-el.el
|
|
197 ;; so that the .el files always get loaded (the .elc files may be out-of-
|
|
198 ;; date or bad).
|
|
199 (when (member "recompile" command-line-args)
|
|
200 (let ((command-line-args-left (cdr (member "recompile" command-line-args))))
|
|
201 (batch-byte-recompile-directory)
|
|
202 (kill-emacs)))
|
|
203
|
|
204 ;; For machines with CANNOT_DUMP defined in config.h,
|
|
205 ;; this file must be loaded each time Emacs is run.
|
|
206 ;; So run the startup code now.
|
|
207
|
|
208 (when (not (fboundp 'dump-emacs))
|
|
209 ;; Avoid loading loadup.el a second time!
|
|
210 (setq command-line-args (cdr (cdr command-line-args)))
|
|
211 (eval top-level))
|
|
212
|
|
213 ;;; loadup.el ends here
|