0
|
1 ;;; loadup.el --- load up standardly loaded Lisp files for XEmacs.
|
|
2
|
2
|
3 ;; Copyright (C) 1985, 1986, 1992, 1994 Free Software Foundation, Inc.
|
0
|
4 ;; Copyright (C) 1996 Richard Mlynarik.
|
|
5 ;; Copyright (C) 1995, 1996 Ben Wing.
|
|
6
|
|
7 ;; Keywords: internal
|
|
8
|
|
9 ;; This file is part of XEmacs.
|
|
10
|
|
11 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
12 ;; under the terms of the GNU General Public License as published by
|
|
13 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
14 ;; any later version.
|
|
15
|
|
16 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
19 ;; General Public License for more details.
|
|
20
|
|
21 ;; You should have received a copy of the GNU General Public License
|
|
22 ;; along with XEmacs; see the file COPYING. If not, write to the Free
|
2
|
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
24 ;; 02111-1307, USA.
|
0
|
25
|
70
|
26 ;;; Synched up with: Last synched with FSF 19.30, with wild divergence since.
|
0
|
27
|
|
28 ;;; Commentary:
|
|
29
|
155
|
30 ;; It is not a good idea to edit this file. Use site-init.el or site-load.el
|
|
31 ;; instead.
|
|
32 ;;
|
0
|
33 ;; This is loaded into a bare Emacs to make a dumpable one.
|
|
34
|
|
35 ;;; Code:
|
|
36
|
|
37 (if (fboundp 'error)
|
|
38 (error "loadup.el already loaded!"))
|
|
39
|
|
40 (define-function 'defalias 'define-function)
|
124
|
41 (defvar running-xemacs t
|
|
42 "non-nil when the current emacsen is XEmacs.")
|
0
|
43
|
|
44 (call-with-condition-handler
|
|
45 ;; This is awfully damn early to be getting an error, right?
|
|
46 'really-early-error-handler
|
|
47 #'(lambda ()
|
70
|
48 ;; message not defined yet ...
|
0
|
49 (external-debugging-output (format "\nUsing load-path %s" load-path))
|
|
50
|
|
51 ;; We don't want to have any undo records in the dumped XEmacs.
|
|
52 (buffer-disable-undo (get-buffer "*scratch*"))
|
|
53
|
|
54 ;; lread.c (or src/Makefile.in.in) has prepended "${srcdir}/../lisp/prim"
|
|
55 ;; to load-path, which is how this file has been found. At this point,
|
|
56 ;; enough of emacs has been initialized that we can call directory-files
|
|
57 ;; and get the rest of the dirs (so that we can dump stuff from modes/
|
|
58 ;; and packages/.)
|
|
59 ;;
|
|
60 (let ((temp-path (expand-file-name ".." (car load-path))))
|
|
61 (setq source-directory temp-path)
|
|
62 (setq load-path (nconc (directory-files temp-path t "^[^-.]"
|
|
63 nil 'dirs-only)
|
|
64 (cons temp-path load-path))))
|
|
65
|
|
66 (setq load-warn-when-source-newer t ; set to nil at the end
|
70
|
67 load-warn-when-source-only t)
|
50
|
68
|
167
|
69 ;; Inserted for debugging. Something is corrupting a single symbol
|
|
70 ;; somewhere to have an integer 0 property list. -slb 6/28/1997.
|
|
71 (defun test-atoms ()
|
|
72 (mapatoms
|
|
73 #'(lambda (symbol)
|
|
74 (condition-case nil
|
|
75 (get symbol 'custom-group)
|
|
76 (t (princ
|
|
77 (format "Bad plist in %s, %s\n"
|
|
78 (symbol-name symbol)
|
|
79 (prin1-to-string (object-plist symbol)))))))))
|
|
80
|
2
|
81 ;; garbage collect after loading every file in an attempt to
|
|
82 ;; minimize the size of the dumped image (if we don't do this,
|
|
83 ;; there will be lots of extra space in the data segment filled
|
|
84 ;; with garbage-collected junk)
|
|
85 (defmacro load-gc (file)
|
167
|
86 (list 'prog1 (list 'load file)
|
|
87 ;; '(test-atoms)
|
|
88 '(garbage-collect)))
|
163
|
89 ;; Need a minimal number hardcoded to get going for now.
|
|
90 ;; (load-gc "backquote") ; needed for defsubst etc.
|
|
91 ;; (load-gc "bytecomp-runtime") ; define defsubst
|
|
92 ;; (load-gc "subr") ; load the most basic Lisp functions
|
|
93 ;; (load-gc "replace") ; match-string used in version.el.
|
|
94 ;; (load-gc "version.el") ; Ignore compiled-by-mistake version.elc
|
|
95 ;; (load-gc "cl")
|
|
96 ;; (load-gc "featurep") ; OBSOLETE now
|
|
97 (let (dumped-lisp-packages file)
|
|
98 (load "dumped-lisp.el")
|
|
99 (while (setq file (car dumped-lisp-packages))
|
|
100 (load-gc file)
|
|
101 (setq dumped-lisp-packages (cdr dumped-lisp-packages)))
|
|
102 (if (not (featurep 'toolbar))
|
|
103 (progn
|
|
104 ;; else still define a few functions.
|
|
105 (defun toolbar-button-p (obj) "No toolbar support." nil)
|
|
106 (defun toolbar-specifier-p (obj) "No toolbar support." nil)))
|
|
107 (fmakunbound 'load-gc))
|
2
|
108 )) ;; end of call-with-condition-handler
|
0
|
109
|
|
110
|
4
|
111 (setq load-warn-when-source-newer t ; set to t at top of file
|
0
|
112 load-warn-when-source-only nil)
|
|
113
|
|
114 (setq debugger 'debug)
|
|
115
|
70
|
116 (when (member "no-site-file" command-line-args)
|
|
117 (setq site-start-file nil))
|
0
|
118
|
2
|
119 ;; If you want additional libraries to be preloaded and their
|
|
120 ;; doc strings kept in the DOC file rather than in core,
|
|
121 ;; you may load them with a "site-load.el" file.
|
|
122 ;; But you must also cause them to be scanned when the DOC file
|
|
123 ;; is generated. For VMS, you must edit ../../vms/makedoc.com.
|
|
124 ;; For other systems, you must edit ../../src/Makefile.in.in.
|
0
|
125 (if (load "site-load" t)
|
|
126 (garbage-collect))
|
|
127
|
70
|
128 ;;FSFmacs randomness
|
|
129 ;;(if (fboundp 'x-popup-menu)
|
|
130 ;; (precompute-menubar-bindings))
|
0
|
131 ;;; Turn on recording of which commands get rebound,
|
|
132 ;;; for the sake of the next call to precompute-menubar-bindings.
|
|
133 ;(setq define-key-rebound-commands nil)
|
|
134
|
|
135
|
2
|
136 ;; Note: all compiled Lisp files loaded above this point
|
|
137 ;; must be among the ones parsed by make-docfile
|
|
138 ;; to construct DOC. Any that are not processed
|
|
139 ;; for DOC will not have doc strings in the dumped XEmacs.
|
0
|
140
|
2
|
141 ;; Don't bother with these if we're running temacs, i.e. if we're
|
|
142 ;; just debugging don't waste time finding doc strings.
|
0
|
143
|
70
|
144 ;; purify-flag is nil if called from loadup-el.el.
|
|
145 (when purify-flag
|
|
146 (message "Finding pointers to doc strings...")
|
167
|
147 ;; (test-atoms) ; Debug -- Doesn't happen here
|
70
|
148 (Snarf-documentation "DOC")
|
167
|
149 ;; (test-atoms) ; Debug -- Doesn't happen here
|
70
|
150 (message "Finding pointers to doc strings...done")
|
167
|
151 (Verify-documentation)
|
|
152 ;; (test-atoms) ; Debug -- Doesn't happen here
|
|
153 )
|
0
|
154
|
70
|
155 ;; Note: You can cause additional libraries to be preloaded
|
|
156 ;; by writing a site-init.el that loads them.
|
|
157 ;; See also "site-load" above.
|
0
|
158 (if (stringp site-start-file)
|
|
159 (load "site-init" t))
|
|
160 (setq current-load-list nil)
|
|
161 (garbage-collect)
|
|
162
|
|
163 ;;; At this point, we're ready to resume undo recording for scratch.
|
|
164 (buffer-enable-undo "*scratch*")
|
|
165
|
70
|
166 ;; Dump into the name `xemacs' (only)
|
|
167 (when (member "dump" command-line-args)
|
|
168 (message "Dumping under the name xemacs")
|
|
169 (condition-case () (delete-file "xemacs") (file-error nil))
|
|
170 (when (fboundp 'really-free)
|
|
171 (really-free))
|
|
172 (dump-emacs "xemacs" "temacs")
|
|
173 (kill-emacs))
|
0
|
174
|
70
|
175 (when (member "run-temacs" command-line-args)
|
|
176 (message "\nBootstrapping from temacs...")
|
|
177 (setq purify-flag nil)
|
|
178 ;; Remove all args up to and including "run-temacs"
|
|
179 (apply #'run-emacs-from-temacs (cdr (member "run-temacs" command-line-args)))
|
|
180 ;; run-emacs-from-temacs doesn't actually return anyway.
|
|
181 (kill-emacs))
|
0
|
182
|
2
|
183 ;; Avoid error if user loads some more libraries now.
|
0
|
184 (setq purify-flag nil)
|
|
185
|
2
|
186 ;; XEmacs change
|
|
187 ;; If you are using 'recompile', then you should have used -l loadup-el.el
|
|
188 ;; so that the .el files always get loaded (the .elc files may be out-of-
|
|
189 ;; date or bad).
|
70
|
190 (when (member "recompile" command-line-args)
|
|
191 (let ((command-line-args-left (cdr (member "recompile" command-line-args))))
|
|
192 (batch-byte-recompile-directory)
|
|
193 (kill-emacs)))
|
0
|
194
|
|
195 ;; For machines with CANNOT_DUMP defined in config.h,
|
|
196 ;; this file must be loaded each time Emacs is run.
|
|
197 ;; So run the startup code now.
|
|
198
|
70
|
199 (when (not (fboundp 'dump-emacs))
|
|
200 ;; Avoid loading loadup.el a second time!
|
|
201 (setq command-line-args (cdr (cdr command-line-args)))
|
|
202 (eval top-level))
|
0
|
203
|
|
204 ;;; loadup.el ends here
|