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

Import from CVS: tag r20-5b12
author cvs
date Mon, 13 Aug 2007 10:12:37 +0200
parents d44af0c54775
children 52952cbfc5b5
comparison
equal deleted inserted replaced
226:eea38c7ad7b4 227:0e522484dd2a
48 ;; belongs here. 48 ;; belongs here.
49 49
50 50
51 ;;; Code: 51 ;;; Code:
52 52
53 ;;; Package versioning
54
55 (defvar packages-package-list nil
56 "database of loaded packages and version numbers")
57
58 (defun package-provide (name version)
59 (if (not (assq name packages-package-list))
60 (setq packages-package-list
61 (cons (cons name version) packages-package-list))))
62
63 (defun package-require (name version)
64 (let ((pkg (assq name packages-package-list)))
65 (cond ((null pkg)
66 (error "Package %s has not been loaded into this XEmacsen"
67 name))
68 ((< (cdr pkg) version)
69 (error "Need version %g of package %s, got version %g"
70 version name (cdr pkg)))
71 (t t))))
72
73 ;;; Build time stuff
74
53 (defvar autoload-file-name "auto-autoloads.el" 75 (defvar autoload-file-name "auto-autoloads.el"
54 "Filename that autoloads are expected to be found in.") 76 "Filename that autoloads are expected to be found in.")
55 77
56 (defvar packages-hardcoded-lisp 78 (defvar packages-hardcoded-lisp
57 '( 79 '(
66 "cl-macs") 88 "cl-macs")
67 "Lisp packages that need early byte compilation.") 89 "Lisp packages that need early byte compilation.")
68 90
69 (defvar packages-unbytecompiled-lisp 91 (defvar packages-unbytecompiled-lisp
70 '("paths.el" 92 '("paths.el"
93 "dumped-lisp.el"
94 "dumped-pkg-lisp.el"
71 "version.el") 95 "version.el")
72 "Lisp packages that should not be byte compiled.") 96 "Lisp packages that should not be byte compiled.")
73 97
74 98
75 ;; Copied from help.el, could possibly move it to here permanently. 99 ;; Copied from help.el, could possibly move it to here permanently.
182 ; "/lisp/")) 206 ; "/lisp/"))
183 (setq load-path 207 (setq load-path
184 (if append-p 208 (if append-p
185 (append load-path (list (concat package "/lisp/"))) 209 (append load-path (list (concat package "/lisp/")))
186 (cons (concat package "/lisp/") load-path))) 210 (cons (concat package "/lisp/") load-path)))
211
212 ;; Locate and process a dumped-lisp.el file if it exists
213 (if (and (running-temacs-p)
214 (file-exists-p (concat package "/lisp/dumped-lisp.el")))
215 (let (package-lisp)
216 (load (concat package "/lisp/dumped-lisp.el"))
217 (if package-lisp
218 (progn
219 (if (boundp 'preloaded-file-list)
220 (setq preloaded-file-list
221 (append preloaded-file-list package-lisp)))
222 (if (fboundp 'load-gc)
223 (setq dumped-lisp-packages
224 (append dumped-lisp-packages package-lisp)))))))
225
187 (if user-package 226 (if user-package
188 (condition-case nil 227 (condition-case nil
189 (load (concat package "/lisp/" 228 (load (concat package "/lisp/"
190 (file-name-sans-extension autoload-file-name))) 229 (file-name-sans-extension autoload-file-name)))
191 (t nil))) 230 (t nil)))
197 ; (print (concat "DIR: " dir "/")) 236 ; (print (concat "DIR: " dir "/"))
198 (setq load-path 237 (setq load-path
199 (if append-p 238 (if append-p
200 (append load-path (list (concat dir "/"))) 239 (append load-path (list (concat dir "/")))
201 (cons (concat dir "/") load-path))) 240 (cons (concat dir "/") load-path)))
241
242 ;; Locate and process a dumped-lisp.el file if it exists
243 (if (and (running-temacs-p)
244 (file-exists-p (concat dir "/dumped-lisp.el")))
245 (let (package-lisp)
246 (load (concat dir "/dumped-lisp.el"))
247 (if package-lisp
248 (progn
249 (if (boundp 'preloaded-file-list)
250 (setq preloaded-file-list
251 (append preloaded-file-list package-lisp)))
252 (if (fboundp 'load-gc)
253 (setq dumped-lisp-packages
254 (append dumped-lisp-packages package-lisp)))))))
255
202 (if user-package 256 (if user-package
203 (condition-case nil 257 (condition-case nil
204 (progn 258 (progn
205 ; (print 259 ; (print
206 ; (concat dir "/" 260 ; (concat dir "/"