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