comparison lisp/loadup.el @ 227:0e522484dd2a r20-5b12

Import from CVS: tag r20-5b12
author cvs
date Mon, 13 Aug 2007 10:12:37 +0200
parents 2c611d1463a6
children 85a06df23a9a
comparison
equal deleted inserted replaced
226:eea38c7ad7b4 227:0e522484dd2a
42 (defvar running-xemacs t 42 (defvar running-xemacs t
43 "Non-nil when the current emacsen is XEmacs.") 43 "Non-nil when the current emacsen is XEmacs.")
44 (defvar preloaded-file-list nil 44 (defvar preloaded-file-list nil
45 "List of files preloaded into the XEmacs binary image.") 45 "List of files preloaded into the XEmacs binary image.")
46 46
47 (call-with-condition-handler 47 ;; This is awfully damn early to be getting an error, right?
48 ;; This is awfully damn early to be getting an error, right? 48 (call-with-condition-handler 'really-early-error-handler
49 'really-early-error-handler 49 #'(lambda ()
50 #'(lambda () 50 ;; message not defined yet ...
51 ;; message not defined yet ... 51 (external-debugging-output (format "\nUsing load-path %s" load-path))
52 (external-debugging-output (format "\nUsing load-path %s" load-path)) 52
53 53 ;; We don't want to have any undo records in the dumped XEmacs.
54 ;; We don't want to have any undo records in the dumped XEmacs. 54 (buffer-disable-undo (get-buffer "*scratch*"))
55 (buffer-disable-undo (get-buffer "*scratch*")) 55
56 56 ;; lread.c (or src/Makefile.in.in) has prepended
57 ;; lread.c (or src/Makefile.in.in) has prepended "${srcdir}/../lisp/" 57 ;; "${srcdir}/../lisp/" to load-path, which is how this file
58 ;; to load-path, which is how this file has been found. At this point, 58 ;; has been found. At this point, enough of XEmacs has been
59 ;; enough of emacs has been initialized that we can call directory-files 59 ;; initialized that we can start dumping "standard" lisp.
60 ;; and get the rest of the dirs (so that we can dump stuff from modes/ 60 ;; Dumped lisp from external packages is added when we search
61 ;; and packages/.) 61 ;; the `package-path'.
62 ;; 62 ;; #### This code is duplicated in two other places.
63 (let ((temp-path (expand-file-name "." (car load-path)))) 63 (let ((temp-path (expand-file-name "." (car load-path))))
64 (setq source-directory temp-path) 64 (setq source-directory temp-path)
65 (setq load-path (nconc (mapcar 65 (setq load-path (nconc (mapcar
66 #'(lambda (i) (concat i "/")) 66 #'(lambda (i) (concat i "/"))
67 (directory-files temp-path t "^[^-.]" 67 (directory-files temp-path t "^[^-.]"
68 nil 'dirs-only)) 68 nil 'dirs-only))
69 (cons (file-name-as-directory temp-path) 69 (cons (file-name-as-directory temp-path)
70 load-path)))) 70 load-path))))
71 71
72 (setq load-warn-when-source-newer t ; set to nil at the end 72 (setq load-warn-when-source-newer t ; Used to be set to nil at the end
73 load-warn-when-source-only t) 73 load-warn-when-source-only t) ; Set to nil at the end
74 74
75 ;; Inserted for debugging. Something is corrupting a single symbol 75 ;; Inserted for debugging. Something is corrupting a single symbol
76 ;; somewhere to have an integer 0 property list. -slb 6/28/1997. 76 ;; somewhere to have an integer 0 property list. -slb 6/28/1997.
77 (defun test-atoms () 77 (defun test-atoms ()
78 (mapatoms 78 (mapatoms
79 #'(lambda (symbol) 79 #'(lambda (symbol)
80 (condition-case nil 80 (condition-case nil
81 (get symbol 'custom-group) 81 (get symbol 'custom-group)
82 (t (princ 82 (t (princ
83 (format "Bad plist in %s, %s\n" 83 (format "Bad plist in %s, %s\n"
84 (symbol-name symbol) 84 (symbol-name symbol)
85 (prin1-to-string (object-plist symbol))))))))) 85 (prin1-to-string (object-plist symbol)))))))))
86 86
87 ;; garbage collect after loading every file in an attempt to 87 ;; garbage collect after loading every file in an attempt to
88 ;; minimize the size of the dumped image (if we don't do this, 88 ;; minimize the size of the dumped image (if we don't do this,
89 ;; there will be lots of extra space in the data segment filled 89 ;; there will be lots of extra space in the data segment filled
90 ;; with garbage-collected junk) 90 ;; with garbage-collected junk)
91 (defmacro load-gc (file) 91 (defmacro load-gc (file)
92 (list 'prog1 (list 'load file) 92 (list 'prog1
93 ;; '(test-atoms) 93 (list 'load
94 '(garbage-collect))) 94 (list 'locate-file file
95 ;; Need a minimal number hardcoded to get going for now. 95 'load-path
96 ;; (load-gc "backquote") ; needed for defsubst etc. 96 (list 'if 'load-ignore-elc-files
97 ;; (load-gc "bytecomp-runtime") ; define defsubst 97 ".el:"
98 ;; (load-gc "subr") ; load the most basic Lisp functions 98 ".elc:.el:")))
99 ;; (load-gc "replace") ; match-string used in version.el. 99 ;; '(test-atoms)
100 ;; (load-gc "version.el") ; Ignore compiled-by-mistake version.elc 100 '(garbage-collect)))
101 ;; (load-gc "cl") 101
102 ;; (load-gc "featurep") ; OBSOLETE now 102 (load (concat default-directory "../lisp/dumped-lisp.el"))
103 (load "dumped-lisp.el") 103 (let ((dumped-lisp-packages preloaded-file-list)
104 (let ((dumped-lisp-packages preloaded-file-list) 104 file)
105 file) 105 (while (setq file (car dumped-lisp-packages))
106 (while (setq file (car dumped-lisp-packages)) 106 (load-gc file)
107 (load-gc file) 107 (setq dumped-lisp-packages (cdr dumped-lisp-packages)))
108 (setq dumped-lisp-packages (cdr dumped-lisp-packages))) 108 (if (not (featurep 'toolbar))
109 (if (not (featurep 'toolbar)) 109 (progn
110 (progn 110 ;; else still define a few functions.
111 ;; else still define a few functions. 111 (defun toolbar-button-p (obj) "No toolbar support." nil)
112 (defun toolbar-button-p (obj) "No toolbar support." nil) 112 (defun toolbar-specifier-p (obj) "No toolbar support." nil)))
113 (defun toolbar-specifier-p (obj) "No toolbar support." nil))) 113 (fmakunbound 'load-gc))
114 (fmakunbound 'load-gc)) 114 )) ;; end of call-with-condition-handler
115 )) ;; end of call-with-condition-handler
116
117 115
118 ;; Fix up the preloaded file list 116 ;; Fix up the preloaded file list
119 (setq preloaded-file-list (mapcar #'file-name-sans-extension 117 (setq preloaded-file-list (mapcar #'file-name-sans-extension
120 preloaded-file-list)) 118 preloaded-file-list))
121 119