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
|
50
|
68 ;; Inserted for debugging. Something is corrupting a single symbol
|
|
69 ;; somewhere to have an integer 0 property list. -slb 6/28/1997.
|
|
70 (defun test-atoms ()
|
|
71 (mapatoms
|
|
72 #'(lambda (symbol)
|
|
73 (condition-case nil
|
|
74 (get symbol 'custom-group)
|
|
75 (t (princ
|
|
76 (format "Bad plist in %s, %s\n"
|
|
77 (symbol-name symbol)
|
|
78 (prin1-to-string (object-plist symbol)))))))))
|
|
79
|
2
|
80 ;; garbage collect after loading every file in an attempt to
|
|
81 ;; minimize the size of the dumped image (if we don't do this,
|
|
82 ;; there will be lots of extra space in the data segment filled
|
|
83 ;; with garbage-collected junk)
|
|
84 (defmacro load-gc (file)
|
|
85 (list 'prog1 (list 'load file) '(garbage-collect)))
|
|
86 (load-gc "backquote") ; needed for defsubst etc.
|
|
87 (load-gc "bytecomp-runtime") ; define defsubst
|
|
88 (load-gc "subr") ; load the most basic Lisp functions
|
|
89 (load-gc "replace") ; match-string used in version.el.
|
|
90 (load-gc "version.el") ; Ignore compiled-by-mistake version.elc
|
|
91 (load-gc "cl")
|
|
92 (load-gc "cmdloop")
|
|
93 (or (fboundp 'recursive-edit) (load-gc "cmdloop1"))
|
|
94 (load-gc "keymap")
|
|
95 (load-gc "syntax")
|
|
96 (load-gc "device")
|
|
97 (load-gc "console")
|
|
98 (load-gc "obsolete")
|
|
99 (load-gc "specifier")
|
|
100 (load-gc "faces") ; must be loaded before any make-face call
|
|
101 ;(load-gc "facemenu") #### not yet ported
|
|
102 (load-gc "glyphs")
|
|
103 (load-gc "objects")
|
|
104 (load-gc "extents")
|
|
105 (load-gc "events")
|
|
106 (load-gc "text-props")
|
|
107 (load-gc "process")
|
|
108 (load-gc "frame") ; move up here cause some stuff needs it here
|
|
109 (load-gc "map-ynp")
|
|
110 (load-gc "simple")
|
|
111 (load-gc "keydefs") ; Before loaddefs so that keymap vars exist.
|
|
112 (load-gc "abbrev")
|
|
113 (load-gc "derived")
|
|
114 (load-gc "minibuf")
|
|
115 (load-gc "list-mode")
|
|
116 (load-gc "modeline") ; after simple.el so it can reference functions
|
|
117 ; defined there.
|
18
|
118 (load-gc "help")
|
|
119 (load-gc "buff-menu")
|
20
|
120 ;; (load-gc "w3-sysdp")
|
18
|
121 (load-gc "widget")
|
|
122 (load-gc "custom") ; Before loaddefs so that defcustom exists.
|
2
|
123 ;; If SparcWorks support is included some additional packages are
|
|
124 ;; dumped which would normally have autoloads. To avoid
|
|
125 ;; duplicate doc string warnings, SparcWorks uses a separate
|
|
126 ;; autoloads file with the dumped packages removed.
|
|
127 ;;; After fixing, eos/loaddefs-eos and loaddefs appear identical?!!
|
|
128 ;;; So just make loaddefs-eos go away...
|
|
129 ;;;(load-gc (if (featurep 'sparcworks) "eos/loaddefs-eos" "loaddefs"))
|
24
|
130 (load-gc "loaddefs") ; <=== autoloads get put here
|
2
|
131 (load-gc "misc")
|
|
132 (load-gc "profile")
|
|
133 ;; (load-gc "hyper-apropos") Soon...
|
|
134 (load-gc "files")
|
|
135 (load-gc "lib-complete")
|
|
136 (load-gc "format")
|
|
137 (load-gc "indent")
|
|
138 (load-gc "isearch-mode")
|
|
139 (load-gc "buffer")
|
|
140 (load-gc "undo-stack")
|
|
141 (load-gc "window")
|
|
142 (load-gc "paths.el") ; don't get confused if paths compiled.
|
|
143 (load-gc "startup")
|
|
144 (load-gc "lisp")
|
|
145 (load-gc "page")
|
|
146 (load-gc "register")
|
|
147 (load-gc "iso8859-1") ; This must be before any modes
|
0
|
148 ; (sets standard syntax table.)
|
2
|
149 (load-gc "paragraphs")
|
|
150 (load-gc "lisp-mode")
|
|
151 (load-gc "text-mode")
|
|
152 (load-gc "fill")
|
4
|
153 ;; (load-gc "cc-mode") ; as FSF goes so go we ..
|
8
|
154 ;; (load-gc "scroll-in-place") ; We're not ready for this :-(
|
2
|
155 ;; we no longer load buff-menu automatically.
|
|
156 ;; it will get autoloaded if needed.
|
|
157
|
|
158 (cond ; Differences based on system-type
|
|
159 ((eq system-type 'vax-vms)
|
|
160 (load-gc "vmsproc")
|
|
161 (load-gc "vms-patch"))
|
|
162 ((eq system-type 'windows-nt)
|
|
163 (load-gc "ls-lisp")
|
|
164 (load-gc "winnt"))
|
|
165 ((eq system-type 'ms-dos)
|
|
166 (load-gc "ls-lisp")
|
|
167 (load-gc "dos-fns")
|
|
168 (load-gc "disp-table"))) ; needed to setup ibm-pc char set,
|
|
169 ; see internal.el
|
|
170 (when (featurep 'lisp-float-type)
|
|
171 (load-gc "float-sup"))
|
|
172 (load-gc "itimer") ; for vars auto-save-timeout and auto-gc-threshold
|
26
|
173 (load-gc "itimer-autosave")
|
2
|
174 (if (featurep 'toolbar)
|
|
175 (load-gc "toolbar")
|
|
176 ;; else still define a few functions.
|
|
177 (defun toolbar-button-p (obj) "No toolbar support." nil)
|
|
178 (defun toolbar-specifier-p (obj) "No toolbar support." nil))
|
|
179 (when (featurep 'scrollbar)
|
|
180 (load-gc "scrollbar"))
|
|
181 (when (featurep 'menubar)
|
|
182 (load-gc "menubar"))
|
|
183 (when (featurep 'dialog)
|
|
184 (load-gc "dialog"))
|
|
185 (when (featurep 'window-system)
|
|
186 (load-gc "gui")
|
|
187 (load-gc "mode-motion")
|
|
188 (load-gc "mouse"))
|
|
189 (when (featurep 'x)
|
|
190 ;; preload the X code, for faster startup.
|
|
191 (when (featurep 'menubar)
|
|
192 (load-gc "x-menubar")
|
|
193 ;; autoload this.
|
|
194 ;;(load-gc "x-font-menu")
|
|
195 )
|
|
196 (load-gc "x-faces")
|
|
197 (load-gc "x-iso8859-1")
|
|
198 (load-gc "x-mouse")
|
|
199 (load-gc "x-select")
|
|
200 (when (featurep 'scrollbar)
|
|
201 (load-gc "x-scrollbar"))
|
|
202 (load-gc "x-misc")
|
|
203 (load-gc "x-init")
|
|
204 (when (featurep 'toolbar)
|
|
205 (load-gc "x-toolbar"))
|
|
206 )
|
|
207 (when (featurep 'tty)
|
|
208 ;; preload the TTY init code.
|
|
209 (load-gc "tty-init"))
|
|
210 (when (featurep 'tooltalk)
|
|
211 (load-gc "tooltalk/tooltalk-load"))
|
|
212 (load-gc "vc-hooks")
|
|
213 (load-gc "ediff-hook")
|
|
214 (load-gc "fontl-hooks")
|
|
215 (load-gc "auto-show")
|
|
216 (when (featurep 'energize)
|
|
217 (load-gc "energize/energize-load.el"))
|
|
218 (when (featurep 'sparcworks)
|
|
219 (load-gc "sunpro/sunpro-load.el"))
|
32
|
220 (load-gc "custom-load")
|
2
|
221 (fmakunbound 'load-gc)
|
|
222 )) ;; end of call-with-condition-handler
|
0
|
223
|
|
224
|
4
|
225 (setq load-warn-when-source-newer t ; set to t at top of file
|
0
|
226 load-warn-when-source-only nil)
|
|
227
|
|
228 (setq debugger 'debug)
|
|
229
|
|
230 (if (or (equal (nth 4 command-line-args) "no-site-file")
|
|
231 (equal (nth 5 command-line-args) "no-site-file"))
|
|
232 (setq site-start-file nil))
|
|
233
|
2
|
234 ;; If you want additional libraries to be preloaded and their
|
|
235 ;; doc strings kept in the DOC file rather than in core,
|
|
236 ;; you may load them with a "site-load.el" file.
|
|
237 ;; But you must also cause them to be scanned when the DOC file
|
|
238 ;; is generated. For VMS, you must edit ../../vms/makedoc.com.
|
|
239 ;; For other systems, you must edit ../../src/Makefile.in.in.
|
0
|
240 (if (load "site-load" t)
|
|
241 (garbage-collect))
|
|
242
|
|
243 ;FSFmacs randomness
|
|
244 ;(if (fboundp 'x-popup-menu)
|
|
245 ; (precompute-menubar-bindings))
|
|
246 ;;; Turn on recording of which commands get rebound,
|
|
247 ;;; for the sake of the next call to precompute-menubar-bindings.
|
|
248 ;(setq define-key-rebound-commands nil)
|
|
249
|
|
250 ;;FSFmacs #### what?
|
|
251 ;; Determine which last version number to use
|
|
252 ;; based on the executables that now exist.
|
|
253 ;(if (and (or (equal (nth 3 command-line-args) "dump")
|
|
254 ; (equal (nth 4 command-line-args) "dump"))
|
|
255 ; (not (eq system-type 'ms-dos)))
|
|
256 ; (let* ((base (concat "emacs-" emacs-version "."))
|
|
257 ; (files (file-name-all-completions base default-directory))
|
|
258 ; (versions (mapcar (function (lambda (name)
|
|
259 ; (string-to-int (substring name (length base)))))
|
|
260 ; files)))
|
|
261 ; (setq emacs-version (format "%s.%d"
|
|
262 ; emacs-version
|
|
263 ; (if versions
|
|
264 ; (1+ (apply 'max versions))
|
|
265 ; 1)))))
|
|
266
|
2
|
267 ;; Note: all compiled Lisp files loaded above this point
|
|
268 ;; must be among the ones parsed by make-docfile
|
|
269 ;; to construct DOC. Any that are not processed
|
|
270 ;; for DOC will not have doc strings in the dumped XEmacs.
|
0
|
271
|
2
|
272 ;; Don't bother with these if we're running temacs, i.e. if we're
|
|
273 ;; just debugging don't waste time finding doc strings.
|
0
|
274
|
|
275 (if (or (equal (nth 3 command-line-args) "dump")
|
|
276 (equal (nth 4 command-line-args) "dump"))
|
|
277 (progn
|
|
278 (message "Finding pointers to doc strings...")
|
|
279 (if (fboundp 'dump-emacs)
|
|
280 (let ((name emacs-version))
|
|
281 (string-match " Lucid" name)
|
|
282 (setq name (concat (substring name 0 (match-beginning 0))
|
|
283 (substring name (match-end 0))))
|
|
284 (while (string-match "[^-+_.a-zA-Z0-9]+" name)
|
|
285 (setq name (concat
|
|
286 (downcase (substring name 0 (match-beginning 0)))
|
|
287 "-"
|
|
288 (substring name (match-end 0)))))
|
|
289 (if (string-match "-+\\'" name)
|
|
290 (setq name (substring name 0 (match-beginning 0))))
|
|
291 (if (memq system-type '(ms-dos windows-nt))
|
|
292 (setq name (expand-file-name
|
|
293 (if (fboundp 'make-frame) "DOC-X" "DOC") "../etc"))
|
|
294 (setq name (concat (expand-file-name "DOC-" "../lib-src") name))
|
|
295 (if (file-exists-p name)
|
|
296 (delete-file name))
|
|
297 (copy-file (expand-file-name "DOC" "../lib-src") name t))
|
|
298 (Snarf-documentation (file-name-nondirectory name)))
|
|
299 (Snarf-documentation "DOC"))
|
|
300 (message "Finding pointers to doc strings...done")
|
|
301 (Verify-documentation)
|
|
302 ))
|
|
303
|
2
|
304 ; Note: You can cause additional libraries to be preloaded
|
|
305 ; by writing a site-init.el that loads them.
|
|
306 ; See also "site-load" above.
|
0
|
307 (if (stringp site-start-file)
|
|
308 (load "site-init" t))
|
|
309 (setq current-load-list nil)
|
|
310 (garbage-collect)
|
|
311
|
|
312 ;;; At this point, we're ready to resume undo recording for scratch.
|
|
313 (buffer-enable-undo "*scratch*")
|
|
314
|
|
315 (if (or (equal (nth 3 command-line-args) "dump")
|
|
316 (equal (nth 4 command-line-args) "dump"))
|
|
317 (if (eq system-type 'vax-vms)
|
|
318 (progn
|
|
319 (setq command-line-args nil)
|
|
320 (message "Dumping data as file temacs.dump")
|
|
321 (dump-emacs "temacs.dump" "temacs")
|
|
322 (kill-emacs))
|
|
323 (let ((name (concat "emacs-" emacs-version)))
|
|
324 (string-match " Lucid" name)
|
|
325 (setq name (concat (substring name 0 (match-beginning 0))
|
|
326 (substring name (match-end 0))))
|
|
327 (while (string-match "[^-+_.a-zA-Z0-9]+" name)
|
|
328 (setq name (concat (downcase (substring name 0 (match-beginning 0)))
|
|
329 "-"
|
|
330 (substring name (match-end 0)))))
|
|
331 (if (string-match "-+\\'" name)
|
|
332 (setq name (substring name 0 (match-beginning 0))))
|
|
333 (if (eq system-type 'ms-dos)
|
|
334 (message "Dumping under the name xemacs")
|
2
|
335 (message "Dumping under names xemacs and %s" name))
|
|
336 (condition-case () (delete-file name ) (file-error nil))
|
|
337 (condition-case () (delete-file "xemacs") (file-error nil))
|
|
338 )
|
0
|
339 (if (fboundp 'really-free)
|
|
340 (really-free))
|
|
341 ;; Note that FSF used to dump under `xemacs'!
|
|
342 (dump-emacs "xemacs" "temacs")
|
|
343 ;This is done automatically.
|
|
344 ;(message "%d pure bytes used" pure-bytes-used)
|
|
345 ;; Recompute NAME now, so that it isn't set when we dump.
|
|
346 (if (not (memq system-type '(ms-dos windows-nt)))
|
|
347 (let ((name (concat "emacs-" emacs-version)))
|
|
348 (string-match " Lucid" name)
|
|
349 (setq name (concat (substring name 0 (match-beginning 0))
|
|
350 (substring name (match-end 0))))
|
|
351 (while (string-match "[^-+_.a-zA-Z0-9]+" name)
|
|
352 (setq name (concat (downcase (substring name 0
|
|
353 (match-beginning 0)))
|
|
354 "-"
|
|
355 (substring name (match-end 0)))))
|
|
356 (if (string-match "-+\\'" name)
|
|
357 (setq name (substring name 0 (match-beginning 0))))
|
|
358 (add-name-to-file "xemacs" name t)))
|
|
359 (kill-emacs)))
|
|
360
|
|
361 (if (or (equal (nth 3 command-line-args) "run-temacs")
|
|
362 (equal (nth 4 command-line-args) "run-temacs"))
|
|
363 (progn
|
|
364 ;; purify-flag is nil if called from loadup-el.el.
|
|
365 (if purify-flag
|
|
366 (progn
|
|
367 (message "\nSnarfing doc...")
|
|
368 (Snarf-documentation "DOC")
|
|
369 (Verify-documentation)))
|
|
370 (message "\nBootstrapping from temacs...")
|
|
371 (setq purify-flag nil)
|
|
372 (apply #'run-emacs-from-temacs
|
|
373 (nthcdr (if (equal (nth 3 command-line-args) "run-temacs")
|
|
374 4 5)
|
|
375 command-line-args))
|
|
376 ;; run-emacs-from-temacs doesn't actually return anyway.
|
|
377 (kill-emacs)))
|
|
378
|
2
|
379 ;; Avoid error if user loads some more libraries now.
|
0
|
380 (setq purify-flag nil)
|
|
381
|
2
|
382 ;; XEmacs change
|
|
383 ;; If you are using 'recompile', then you should have used -l loadup-el.el
|
|
384 ;; so that the .el files always get loaded (the .elc files may be out-of-
|
|
385 ;; date or bad).
|
0
|
386 (if (or (equal (nth 3 command-line-args) "recompile")
|
|
387 (equal (nth 4 command-line-args) "recompile"))
|
|
388 (progn
|
|
389 (let ((command-line-args-left
|
|
390 (nthcdr (if (equal (nth 3 command-line-args) "recompile")
|
|
391 4 5)
|
|
392 command-line-args)))
|
|
393 (batch-byte-recompile-directory)
|
|
394 (kill-emacs))))
|
|
395
|
|
396
|
|
397 ;; For machines with CANNOT_DUMP defined in config.h,
|
|
398 ;; this file must be loaded each time Emacs is run.
|
|
399 ;; So run the startup code now.
|
|
400
|
|
401 (or (fboundp 'dump-emacs)
|
|
402 (progn
|
|
403 ;; Avoid loading loadup.el a second time!
|
|
404 (setq command-line-args (cdr (cdr command-line-args)))
|
|
405 (eval top-level)))
|
|
406
|
|
407 ;;; loadup.el ends here
|