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 source-directory temp-path)
68 (setq load-path (nconc (mapcar
69 #'(lambda (i) (concat i "/"))
70 (directory-files temp-path t "^[^-.]"
72 (cons (file-name-as-directory temp-path)
75 (setq load-warn-when-source-newer t ; Used to be set to nil at the end
76 load-warn-when-source-only t) ; Set to nil at the end
78 ;; garbage collect after loading every file in an attempt to
79 ;; minimize the size of the dumped image (if we don't do this,
80 ;; there will be lots of extra space in the data segment filled
81 ;; with garbage-collected junk)
82 (defun pureload (file)
83 (let ((full-path (locate-file file
85 (if load-ignore-elc-files
92 (external-debugging-output (format "\nLoad file %s: not found\n"
94 ;; Uncomment in case of trouble
95 ;;(print (format "late-packages: %S" late-packages))
96 ;;(print (format "guessed-roots: %S" (paths-find-emacs-roots invocation-directory invocation-name)))
99 (load (concat default-directory "../lisp/dumped-lisp.el"))
101 (let ((files preloaded-file-list)
103 (while (setq file (car files))
106 (external-debugging-output "Fatal error during load, aborting")
108 (setq files (cdr files)))
109 (if (not (featurep 'toolbar))
111 ;; else still define a few functions.
112 (defun toolbar-button-p (obj) "No toolbar support." nil)
113 (defun toolbar-specifier-p (obj) "No toolbar support." nil)))
114 (fmakunbound 'pureload))
116 (packages-load-package-dumped-lisps late-package-load-path)
118 )) ;; end of call-with-condition-handler
120 ;; Fix up the preloaded file list
121 (setq preloaded-file-list (mapcar #'file-name-sans-extension
122 preloaded-file-list))
124 (setq load-warn-when-source-newer t ; set to t at top of file
125 load-warn-when-source-only nil)
127 (setq debugger 'debug)
129 (when (member "no-site-file" command-line-args)
130 (setq site-start-file nil))
132 ;; If you want additional libraries to be preloaded and their
133 ;; doc strings kept in the DOC file rather than in core,
134 ;; you may load them with a "site-load.el" file.
135 ;; But you must also cause them to be scanned when the DOC file
136 ;; is generated. For VMS, you must edit ../../vms/makedoc.com.
137 ;; For other systems, you must edit ../../src/Makefile.in.in.
138 (if (load "site-load" t)
142 ;;(if (fboundp 'x-popup-menu)
143 ;; (precompute-menubar-bindings))
144 ;;; Turn on recording of which commands get rebound,
145 ;;; for the sake of the next call to precompute-menubar-bindings.
146 ;(setq define-key-rebound-commands nil)
149 ;; Note: all compiled Lisp files loaded above this point
150 ;; must be among the ones parsed by make-docfile
151 ;; to construct DOC. Any that are not processed
152 ;; for DOC will not have doc strings in the dumped XEmacs.
154 ;; Don't bother with these if we're running temacs, i.e. if we're
155 ;; just debugging don't waste time finding doc strings.
157 ;; purify-flag is nil if called from loadup-el.el.
159 (message "Finding pointers to doc strings...")
160 (Snarf-documentation "DOC")
161 (message "Finding pointers to doc strings...done")
162 (Verify-documentation)
165 ;; Note: You can cause additional libraries to be preloaded
166 ;; by writing a site-init.el that loads them.
167 ;; See also "site-load" above.
168 (if (stringp site-start-file)
169 (load "site-init" t))
170 (setq current-load-list nil)
173 ;;; At this point, we're ready to resume undo recording for scratch.
174 (buffer-enable-undo "*scratch*")
176 ;; Dump into the name `xemacs' (only)
177 (when (member "dump" command-line-args)
178 (message "Dumping under the name xemacs")
179 ;; This is handled earlier in the build process.
180 ;; (condition-case () (delete-file "xemacs") (file-error nil))
181 (when (fboundp 'really-free)
183 (dump-emacs (if (featurep 'infodock) "infodock" "xemacs") "temacs")
186 (when (member "run-temacs" command-line-args)
187 (message "\nBootstrapping from temacs...")
188 (setq purify-flag nil)
189 (setq inhibit-early-packages t)
190 (setq inhibit-autoloads t)
191 ;; Remove all args up to and including "run-temacs"
192 (apply #'run-emacs-from-temacs (cdr (member "run-temacs" command-line-args)))
193 ;; run-emacs-from-temacs doesn't actually return anyway.
196 ;; Avoid error if user loads some more libraries now.
197 (setq purify-flag nil)
200 ;; If you are using 'recompile', then you should have used -l loadup-el.el
201 ;; so that the .el files always get loaded (the .elc files may be out-of-
203 (when (member "recompile" command-line-args)
204 (let ((command-line-args-left (cdr (member "recompile" command-line-args))))
205 (batch-byte-recompile-directory)
208 ;; For machines with CANNOT_DUMP defined in config.h,
209 ;; this file must be loaded each time Emacs is run.
210 ;; So run the startup code now.
212 (when (not (fboundp 'dump-emacs))
213 ;; Avoid loading loadup.el a second time!
214 (setq command-line-args (cdr (cdr command-line-args)))
217 ;;; loadup.el ends here