1 ;; loadup.el --- load up standardly loaded Lisp files for XEmacs.
3 ;; Copyright (C) 1985, 1986, 1992, 1994, 1997 Free Software Foundation, Inc.
4 ;; Copyright (C) 1996 Richard Mlynarik.
5 ;; Copyright (C) 1995, 1996 Ben Wing.
7 ;; Maintainer: XEmacs Development Team
8 ;; Keywords: internal, dumped
10 ;; This file is part of XEmacs.
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)
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.
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
27 ;;; Synched up with: Last synched with FSF 19.30, with wild divergence since.
31 ;; Please do not edit this file. Use site-init.el or site-load.el instead.
33 ;; This is loaded into a bare XEmacs to make a dumpable one.
38 (error "loadup.el already loaded!"))
40 (defvar running-xemacs t
41 "Non-nil when the current emacs is XEmacs.")
42 (defvar preloaded-file-list nil
43 "List of files preloaded into the XEmacs binary image.")
45 ;; This is awfully damn early to be getting an error, right?
46 (call-with-condition-handler 'really-early-error-handler
48 ;; message not defined yet ...
49 (setq load-path (split-path (getenv "EMACSBOOTSTRAPLOADPATH")))
51 (external-debugging-output (format "\nUsing load-path %s" load-path))
53 ;; We don't want to have any undo records in the dumped XEmacs.
54 (buffer-disable-undo (get-buffer "*scratch*"))
56 ;; Load our first bootstrap support
57 (load "very-early-lisp" nil t)
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
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 "^[^-.]"
71 (cons (file-name-as-directory temp-path)
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
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)
81 (defun pureload (file)
82 (let ((full-path (locate-file file
84 (if load-ignore-elc-files
91 (external-debugging-output (format "\nLoad file %s: not found\n"
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)))
98 (load (concat default-directory "../lisp/dumped-lisp.el"))
100 (let ((files preloaded-file-list)
102 (while (setq file (car files))
105 (external-debugging-output "Fatal error during load, aborting")
107 (setq files (cdr files)))
108 (if (not (featurep 'toolbar))
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)))
113 (fmakunbound 'pureload))
115 (packages-load-package-dumped-lisps late-package-load-path)
117 )) ;; end of call-with-condition-handler
119 ;; Fix up the preloaded file list
120 (setq preloaded-file-list (mapcar #'file-name-sans-extension
121 preloaded-file-list))
123 (setq load-warn-when-source-newer t ; set to t at top of file
124 load-warn-when-source-only nil)
126 (setq debugger 'debug)
128 (when (member "no-site-file" command-line-args)
129 (setq site-start-file nil))
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)
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)
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.
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.
156 ;; purify-flag is nil if called from loadup-el.el.
158 (message "Finding pointers to doc strings...")
159 (Snarf-documentation "DOC")
160 (message "Finding pointers to doc strings...done")
161 (Verify-documentation)
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)
172 ;;; At this point, we're ready to resume undo recording for scratch.
173 (buffer-enable-undo "*scratch*")
175 ;; Dump into the name `xemacs' (only)
176 (when (member "dump" command-line-args)
177 (message "Dumping under the name xemacs")
178 ;; This is handled earlier in the build process.
179 ;; (condition-case () (delete-file "xemacs") (file-error nil))
180 (when (fboundp 'really-free)
182 (dump-emacs (if (featurep 'infodock) "infodock" "xemacs") "temacs")
185 ;; Avoid error if user loads some more libraries now.
186 (setq purify-flag nil)
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.
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-
199 (when (member "recompile" command-line-args)
200 (let ((command-line-args-left (cdr (member "recompile" command-line-args))))
201 (batch-byte-recompile-directory)
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.
208 (when (not (fboundp 'dump-emacs))
209 ;; Avoid loading loadup.el a second time!
210 (setq command-line-args (cdr (cdr command-line-args)))
213 ;;; loadup.el ends here