0
|
1 ;;; loadup.el --- load up standardly loaded Lisp files for XEmacs.
|
|
2
|
|
3 ;; It is not a good idea to edit this file. Use site-init.el or site-load.el
|
|
4 ;; instead.
|
|
5 ;;
|
2
|
6 ;; Copyright (C) 1985, 1986, 1992, 1994 Free Software Foundation, Inc.
|
0
|
7 ;; Copyright (C) 1996 Richard Mlynarik.
|
|
8 ;; Copyright (C) 1995, 1996 Ben Wing.
|
|
9
|
|
10 ;; Maintainer: FSF
|
|
11 ;; Keywords: internal
|
|
12
|
|
13 ;; This file is part of XEmacs.
|
|
14
|
|
15 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
16 ;; under the terms of the GNU General Public License as published by
|
|
17 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
18 ;; any later version.
|
|
19
|
|
20 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
21 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
23 ;; General Public License for more details.
|
|
24
|
|
25 ;; You should have received a copy of the GNU General Public License
|
|
26 ;; along with XEmacs; see the file COPYING. If not, write to the Free
|
2
|
27 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
28 ;; 02111-1307, USA.
|
0
|
29
|
2
|
30 ;;; Synched up with: Last synched with FSF 19.30, with divergence since.
|
0
|
31
|
|
32 ;;; Commentary:
|
|
33
|
|
34 ;; This is loaded into a bare Emacs to make a dumpable one.
|
|
35
|
|
36 ;;; Code:
|
|
37
|
|
38 (if (fboundp 'error)
|
|
39 (error "loadup.el already loaded!"))
|
|
40
|
|
41 (define-function 'defalias 'define-function)
|
|
42
|
|
43 (call-with-condition-handler
|
|
44 ;; This is awfully damn early to be getting an error, right?
|
|
45 'really-early-error-handler
|
|
46 #'(lambda ()
|
|
47 ; message not defined yet ...
|
|
48 (external-debugging-output (format "\nUsing load-path %s" load-path))
|
|
49
|
|
50 ;; We don't want to have any undo records in the dumped XEmacs.
|
|
51 (buffer-disable-undo (get-buffer "*scratch*"))
|
|
52
|
|
53 ;; lread.c (or src/Makefile.in.in) has prepended "${srcdir}/../lisp/prim"
|
|
54 ;; to load-path, which is how this file has been found. At this point,
|
|
55 ;; enough of emacs has been initialized that we can call directory-files
|
|
56 ;; and get the rest of the dirs (so that we can dump stuff from modes/
|
|
57 ;; and packages/.)
|
|
58 ;;
|
|
59 (let ((temp-path (expand-file-name ".." (car load-path))))
|
|
60 (setq source-directory temp-path)
|
|
61 (setq load-path (nconc (directory-files temp-path t "^[^-.]"
|
|
62 nil 'dirs-only)
|
|
63 (cons temp-path load-path))))
|
|
64
|
|
65 (setq load-warn-when-source-newer t ; set to nil at the end
|
|
66 load-warn-when-source-only t)
|
|
67
|
2
|
68 ;; garbage collect after loading every file in an attempt to
|
|
69 ;; minimize the size of the dumped image (if we don't do this,
|
|
70 ;; there will be lots of extra space in the data segment filled
|
|
71 ;; with garbage-collected junk)
|
|
72 (defmacro load-gc (file)
|
|
73 (list 'prog1 (list 'load file) '(garbage-collect)))
|
|
74 (load-gc "backquote") ; needed for defsubst etc.
|
|
75 (load-gc "bytecomp-runtime") ; define defsubst
|
|
76 (load-gc "subr") ; load the most basic Lisp functions
|
|
77 (load-gc "replace") ; match-string used in version.el.
|
|
78 (load-gc "version.el") ; Ignore compiled-by-mistake version.elc
|
|
79 (load-gc "cl")
|
|
80 (load-gc "cmdloop")
|
|
81 (or (fboundp 'recursive-edit) (load-gc "cmdloop1"))
|
|
82 (load-gc "keymap")
|
|
83 (load-gc "syntax")
|
|
84 (load-gc "device")
|
|
85 (load-gc "console")
|
|
86 (load-gc "obsolete")
|
|
87 (load-gc "specifier")
|
|
88 (load-gc "faces") ; must be loaded before any make-face call
|
|
89 ;(load-gc "facemenu") #### not yet ported
|
|
90 (load-gc "glyphs")
|
|
91 (load-gc "objects")
|
|
92 (load-gc "extents")
|
|
93 (load-gc "events")
|
|
94 (load-gc "text-props")
|
|
95 (load-gc "process")
|
|
96 (load-gc "frame") ; move up here cause some stuff needs it here
|
|
97 (load-gc "map-ynp")
|
|
98 (load-gc "simple")
|
|
99 (load-gc "keydefs") ; Before loaddefs so that keymap vars exist.
|
|
100 (load-gc "abbrev")
|
|
101 (load-gc "derived")
|
|
102 (load-gc "minibuf")
|
|
103 (load-gc "list-mode")
|
|
104 (load-gc "modeline") ; after simple.el so it can reference functions
|
|
105 ; defined there.
|
|
106 ;; If SparcWorks support is included some additional packages are
|
|
107 ;; dumped which would normally have autoloads. To avoid
|
|
108 ;; duplicate doc string warnings, SparcWorks uses a separate
|
|
109 ;; autoloads file with the dumped packages removed.
|
|
110 ;;; After fixing, eos/loaddefs-eos and loaddefs appear identical?!!
|
|
111 ;;; So just make loaddefs-eos go away...
|
|
112 ;;;(load-gc (if (featurep 'sparcworks) "eos/loaddefs-eos" "loaddefs"))
|
|
113 (load-gc "loaddefs")
|
|
114 (load-gc "misc")
|
|
115 (load-gc "profile")
|
|
116 (load-gc "help")
|
|
117 ;; (load-gc "hyper-apropos") Soon...
|
|
118 (load-gc "files")
|
|
119 (load-gc "lib-complete")
|
|
120 (load-gc "format")
|
|
121 (load-gc "indent")
|
|
122 (load-gc "isearch-mode")
|
|
123 (load-gc "buffer")
|
|
124 (load-gc "buff-menu")
|
|
125 (load-gc "undo-stack")
|
|
126 (load-gc "window")
|
|
127 (load-gc "paths.el") ; don't get confused if paths compiled.
|
|
128 (load-gc "startup")
|
|
129 (load-gc "lisp")
|
|
130 (load-gc "page")
|
|
131 (load-gc "register")
|
|
132 (load-gc "iso8859-1") ; This must be before any modes
|
0
|
133 ; (sets standard syntax table.)
|
2
|
134 (load-gc "paragraphs")
|
|
135 (load-gc "lisp-mode")
|
|
136 (load-gc "text-mode")
|
|
137 (load-gc "fill")
|
|
138 (load-gc "cc-mode")
|
|
139 ;; we no longer load buff-menu automatically.
|
|
140 ;; it will get autoloaded if needed.
|
|
141
|
|
142 (cond ; Differences based on system-type
|
|
143 ((eq system-type 'vax-vms)
|
|
144 (load-gc "vmsproc")
|
|
145 (load-gc "vms-patch"))
|
|
146 ((eq system-type 'windows-nt)
|
|
147 (load-gc "ls-lisp")
|
|
148 (load-gc "winnt"))
|
|
149 ((eq system-type 'ms-dos)
|
|
150 (load-gc "ls-lisp")
|
|
151 (load-gc "dos-fns")
|
|
152 (load-gc "disp-table"))) ; needed to setup ibm-pc char set,
|
|
153 ; see internal.el
|
|
154 (when (featurep 'lisp-float-type)
|
|
155 (load-gc "float-sup"))
|
|
156 (load-gc "itimer") ; for vars auto-save-timeout and auto-gc-threshold
|
|
157 (if (featurep 'toolbar)
|
|
158 (load-gc "toolbar")
|
|
159 ;; else still define a few functions.
|
|
160 (defun toolbar-button-p (obj) "No toolbar support." nil)
|
|
161 (defun toolbar-specifier-p (obj) "No toolbar support." nil))
|
|
162 (when (featurep 'scrollbar)
|
|
163 (load-gc "scrollbar"))
|
|
164 (when (featurep 'menubar)
|
|
165 (load-gc "menubar"))
|
|
166 (when (featurep 'dialog)
|
|
167 (load-gc "dialog"))
|
|
168 (when (featurep 'window-system)
|
|
169 (load-gc "gui")
|
|
170 (load-gc "mode-motion")
|
|
171 (load-gc "mouse"))
|
|
172 (when (featurep 'x)
|
|
173 ;; preload the X code, for faster startup.
|
|
174 (when (featurep 'menubar)
|
|
175 (load-gc "x-menubar")
|
|
176 ;; autoload this.
|
|
177 ;;(load-gc "x-font-menu")
|
|
178 )
|
|
179 (load-gc "x-faces")
|
|
180 (load-gc "x-iso8859-1")
|
|
181 (load-gc "x-mouse")
|
|
182 (load-gc "x-select")
|
|
183 (when (featurep 'scrollbar)
|
|
184 (load-gc "x-scrollbar"))
|
|
185 (load-gc "x-misc")
|
|
186 (load-gc "x-init")
|
|
187 (when (featurep 'toolbar)
|
|
188 (load-gc "x-toolbar"))
|
|
189 )
|
|
190 (when (featurep 'tty)
|
|
191 ;; preload the TTY init code.
|
|
192 (load-gc "tty-init"))
|
|
193 (when (featurep 'tooltalk)
|
|
194 (load-gc "tooltalk/tooltalk-load"))
|
|
195 (load-gc "vc-hooks")
|
|
196 (load-gc "ediff-hook")
|
|
197 (load-gc "fontl-hooks")
|
|
198 (load-gc "auto-show")
|
|
199 (when (featurep 'energize)
|
|
200 (load-gc "energize/energize-load.el"))
|
|
201 (when (featurep 'sparcworks)
|
|
202 (load-gc "sunpro/sunpro-load.el"))
|
|
203 (fmakunbound 'load-gc)
|
|
204 )) ;; end of call-with-condition-handler
|
0
|
205
|
|
206
|
|
207 (setq load-warn-when-source-newer nil ; set to t at top of file
|
|
208 load-warn-when-source-only nil)
|
|
209
|
|
210 (setq debugger 'debug)
|
|
211
|
|
212 (if (or (equal (nth 4 command-line-args) "no-site-file")
|
|
213 (equal (nth 5 command-line-args) "no-site-file"))
|
|
214 (setq site-start-file nil))
|
|
215
|
2
|
216 ;; If you want additional libraries to be preloaded and their
|
|
217 ;; doc strings kept in the DOC file rather than in core,
|
|
218 ;; you may load them with a "site-load.el" file.
|
|
219 ;; But you must also cause them to be scanned when the DOC file
|
|
220 ;; is generated. For VMS, you must edit ../../vms/makedoc.com.
|
|
221 ;; For other systems, you must edit ../../src/Makefile.in.in.
|
0
|
222 (if (load "site-load" t)
|
|
223 (garbage-collect))
|
|
224
|
|
225 ;FSFmacs randomness
|
|
226 ;(if (fboundp 'x-popup-menu)
|
|
227 ; (precompute-menubar-bindings))
|
|
228 ;;; Turn on recording of which commands get rebound,
|
|
229 ;;; for the sake of the next call to precompute-menubar-bindings.
|
|
230 ;(setq define-key-rebound-commands nil)
|
|
231
|
|
232 ;;FSFmacs #### what?
|
|
233 ;; Determine which last version number to use
|
|
234 ;; based on the executables that now exist.
|
|
235 ;(if (and (or (equal (nth 3 command-line-args) "dump")
|
|
236 ; (equal (nth 4 command-line-args) "dump"))
|
|
237 ; (not (eq system-type 'ms-dos)))
|
|
238 ; (let* ((base (concat "emacs-" emacs-version "."))
|
|
239 ; (files (file-name-all-completions base default-directory))
|
|
240 ; (versions (mapcar (function (lambda (name)
|
|
241 ; (string-to-int (substring name (length base)))))
|
|
242 ; files)))
|
|
243 ; (setq emacs-version (format "%s.%d"
|
|
244 ; emacs-version
|
|
245 ; (if versions
|
|
246 ; (1+ (apply 'max versions))
|
|
247 ; 1)))))
|
|
248
|
2
|
249 ;; Note: all compiled Lisp files loaded above this point
|
|
250 ;; must be among the ones parsed by make-docfile
|
|
251 ;; to construct DOC. Any that are not processed
|
|
252 ;; for DOC will not have doc strings in the dumped XEmacs.
|
0
|
253
|
2
|
254 ;; Don't bother with these if we're running temacs, i.e. if we're
|
|
255 ;; just debugging don't waste time finding doc strings.
|
0
|
256
|
|
257 (if (or (equal (nth 3 command-line-args) "dump")
|
|
258 (equal (nth 4 command-line-args) "dump"))
|
|
259 (progn
|
|
260 (message "Finding pointers to doc strings...")
|
|
261 (if (fboundp 'dump-emacs)
|
|
262 (let ((name emacs-version))
|
|
263 (string-match " Lucid" name)
|
|
264 (setq name (concat (substring name 0 (match-beginning 0))
|
|
265 (substring name (match-end 0))))
|
|
266 (while (string-match "[^-+_.a-zA-Z0-9]+" name)
|
|
267 (setq name (concat
|
|
268 (downcase (substring name 0 (match-beginning 0)))
|
|
269 "-"
|
|
270 (substring name (match-end 0)))))
|
|
271 (if (string-match "-+\\'" name)
|
|
272 (setq name (substring name 0 (match-beginning 0))))
|
|
273 (if (memq system-type '(ms-dos windows-nt))
|
|
274 (setq name (expand-file-name
|
|
275 (if (fboundp 'make-frame) "DOC-X" "DOC") "../etc"))
|
|
276 (setq name (concat (expand-file-name "DOC-" "../lib-src") name))
|
|
277 (if (file-exists-p name)
|
|
278 (delete-file name))
|
|
279 (copy-file (expand-file-name "DOC" "../lib-src") name t))
|
|
280 (Snarf-documentation (file-name-nondirectory name)))
|
|
281 (Snarf-documentation "DOC"))
|
|
282 (message "Finding pointers to doc strings...done")
|
|
283 (Verify-documentation)
|
|
284 ))
|
|
285
|
2
|
286 ; Note: You can cause additional libraries to be preloaded
|
|
287 ; by writing a site-init.el that loads them.
|
|
288 ; See also "site-load" above.
|
0
|
289 (if (stringp site-start-file)
|
|
290 (load "site-init" t))
|
|
291 (setq current-load-list nil)
|
|
292 (garbage-collect)
|
|
293
|
|
294 ;;; At this point, we're ready to resume undo recording for scratch.
|
|
295 (buffer-enable-undo "*scratch*")
|
|
296
|
|
297 (if (or (equal (nth 3 command-line-args) "dump")
|
|
298 (equal (nth 4 command-line-args) "dump"))
|
|
299 (if (eq system-type 'vax-vms)
|
|
300 (progn
|
|
301 (setq command-line-args nil)
|
|
302 (message "Dumping data as file temacs.dump")
|
|
303 (dump-emacs "temacs.dump" "temacs")
|
|
304 (kill-emacs))
|
|
305 (let ((name (concat "emacs-" emacs-version)))
|
|
306 (string-match " Lucid" name)
|
|
307 (setq name (concat (substring name 0 (match-beginning 0))
|
|
308 (substring name (match-end 0))))
|
|
309 (while (string-match "[^-+_.a-zA-Z0-9]+" name)
|
|
310 (setq name (concat (downcase (substring name 0 (match-beginning 0)))
|
|
311 "-"
|
|
312 (substring name (match-end 0)))))
|
|
313 (if (string-match "-+\\'" name)
|
|
314 (setq name (substring name 0 (match-beginning 0))))
|
|
315 (if (eq system-type 'ms-dos)
|
|
316 (message "Dumping under the name xemacs")
|
2
|
317 (message "Dumping under names xemacs and %s" name))
|
|
318 (condition-case () (delete-file name ) (file-error nil))
|
|
319 (condition-case () (delete-file "xemacs") (file-error nil))
|
|
320 )
|
0
|
321 (if (fboundp 'really-free)
|
|
322 (really-free))
|
|
323 ;; Note that FSF used to dump under `xemacs'!
|
|
324 (dump-emacs "xemacs" "temacs")
|
|
325 ;This is done automatically.
|
|
326 ;(message "%d pure bytes used" pure-bytes-used)
|
|
327 ;; Recompute NAME now, so that it isn't set when we dump.
|
|
328 (if (not (memq system-type '(ms-dos windows-nt)))
|
|
329 (let ((name (concat "emacs-" emacs-version)))
|
|
330 (string-match " Lucid" name)
|
|
331 (setq name (concat (substring name 0 (match-beginning 0))
|
|
332 (substring name (match-end 0))))
|
|
333 (while (string-match "[^-+_.a-zA-Z0-9]+" name)
|
|
334 (setq name (concat (downcase (substring name 0
|
|
335 (match-beginning 0)))
|
|
336 "-"
|
|
337 (substring name (match-end 0)))))
|
|
338 (if (string-match "-+\\'" name)
|
|
339 (setq name (substring name 0 (match-beginning 0))))
|
|
340 (add-name-to-file "xemacs" name t)))
|
|
341 (kill-emacs)))
|
|
342
|
|
343 (if (or (equal (nth 3 command-line-args) "run-temacs")
|
|
344 (equal (nth 4 command-line-args) "run-temacs"))
|
|
345 (progn
|
|
346 ;; purify-flag is nil if called from loadup-el.el.
|
|
347 (if purify-flag
|
|
348 (progn
|
|
349 (message "\nSnarfing doc...")
|
|
350 (Snarf-documentation "DOC")
|
|
351 (Verify-documentation)))
|
|
352 (message "\nBootstrapping from temacs...")
|
|
353 (setq purify-flag nil)
|
|
354 (apply #'run-emacs-from-temacs
|
|
355 (nthcdr (if (equal (nth 3 command-line-args) "run-temacs")
|
|
356 4 5)
|
|
357 command-line-args))
|
|
358 ;; run-emacs-from-temacs doesn't actually return anyway.
|
|
359 (kill-emacs)))
|
|
360
|
2
|
361 ;; Avoid error if user loads some more libraries now.
|
0
|
362 (setq purify-flag nil)
|
|
363
|
2
|
364 ;; XEmacs change
|
|
365 ;; If you are using 'recompile', then you should have used -l loadup-el.el
|
|
366 ;; so that the .el files always get loaded (the .elc files may be out-of-
|
|
367 ;; date or bad).
|
0
|
368 (if (or (equal (nth 3 command-line-args) "recompile")
|
|
369 (equal (nth 4 command-line-args) "recompile"))
|
|
370 (progn
|
|
371 (let ((command-line-args-left
|
|
372 (nthcdr (if (equal (nth 3 command-line-args) "recompile")
|
|
373 4 5)
|
|
374 command-line-args)))
|
|
375 (batch-byte-recompile-directory)
|
|
376 (kill-emacs))))
|
|
377
|
|
378
|
|
379 ;; For machines with CANNOT_DUMP defined in config.h,
|
|
380 ;; this file must be loaded each time Emacs is run.
|
|
381 ;; So run the startup code now.
|
|
382
|
|
383 (or (fboundp 'dump-emacs)
|
|
384 (progn
|
|
385 ;; Avoid loading loadup.el a second time!
|
|
386 (setq command-line-args (cdr (cdr command-line-args)))
|
|
387 (eval top-level)))
|
|
388
|
|
389 ;;; loadup.el ends here
|