Mercurial > hg > xemacs-beta
comparison lisp/packages.el @ 272:c5d627a313b1 r21-0b34
Import from CVS: tag r21-0b34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:28:48 +0200 |
parents | b2472a1930f2 |
children | ca9a9ec9c1c1 |
comparison
equal
deleted
inserted
replaced
271:c7b7086b0a39 | 272:c5d627a313b1 |
---|---|
61 "Packages early in the load path.") | 61 "Packages early in the load path.") |
62 | 62 |
63 (defvar early-package-load-path nil | 63 (defvar early-package-load-path nil |
64 "Load path for packages early in the load path.") | 64 "Load path for packages early in the load path.") |
65 | 65 |
66 (defvar early-packages nil | 66 (defvar late-packages nil |
67 "Packages late in the load path.") | 67 "Packages late in the load path.") |
68 | 68 |
69 (defvar late-package-load-path nil | 69 (defvar late-package-load-path nil |
70 "Load path for packages late in the load path.") | 70 "Load path for packages late in the load path.") |
71 | |
72 (defvar last-packages nil | |
73 "Packages last in the load path.") | |
74 | |
75 (defvar last-package-load-path nil | |
76 "Load path for packages last in the load path.") | |
71 | 77 |
72 (defun package-get-key-1 (info key) | 78 (defun package-get-key-1 (info key) |
73 "Locate keyword `key' in list." | 79 "Locate keyword `key' in list." |
74 (cond ((null info) | 80 (cond ((null info) |
75 nil) | 81 nil) |
305 (paths-find-site-directory roots | 311 (paths-find-site-directory roots |
306 "mule-packages"))) | 312 "mule-packages"))) |
307 (version-mule-directory | 313 (version-mule-directory |
308 (and (featurep 'mule) | 314 (and (featurep 'mule) |
309 (paths-find-version-directory roots | 315 (paths-find-version-directory roots |
310 "mule-packages")))) | 316 "mule-packages"))) |
317 ;; There needs to be a cleverer way of doing this | |
318 (site-infodock-directory | |
319 (and (featurep 'infodock) | |
320 (paths-find-site-directory roots | |
321 "infodock-packages"))) | |
322 (version-infodock-directory | |
323 (and (featurep 'infodock) | |
324 (paths-find-version-directory roots | |
325 "infodock-packages")))) | |
311 (append '("~/.xemacs/") | 326 (append '("~/.xemacs/") |
312 '(nil) | 327 '(nil) |
328 (and version-infodock-directory | |
329 (null (string-equal version-infodock-directory | |
330 site-infodock-directory)) | |
331 (list version-infodock-directory)) | |
332 (and site-infodock-directory | |
333 (list site-infodock-directory)) | |
313 (and version-mule-directory | 334 (and version-mule-directory |
314 (null (string-equal version-mule-directory | 335 (null (string-equal version-mule-directory |
315 site-mule-directory)) | 336 site-mule-directory)) |
316 (list version-mule-directory)) | 337 (list version-mule-directory)) |
317 (and site-mule-directory | 338 (and site-mule-directory |
334 packages-special-bases))) | 355 packages-special-bases))) |
335 | 356 |
336 (defun packages-split-path (path) | 357 (defun packages-split-path (path) |
337 "Split PATH at NIL, return pair with two components. | 358 "Split PATH at NIL, return pair with two components. |
338 The second component is shared with PATH." | 359 The second component is shared with PATH." |
339 (let ((reverse-tail '())) | 360 (let ((reverse-tail '()) |
340 (while (and path (null (null (car path)))) | 361 (rest path)) |
341 (setq reverse-tail (cons (car path) reverse-tail)) | 362 (while (and rest (null (null (car rest)))) |
342 (setq path (cdr path))) | 363 (setq reverse-tail (cons (car rest) reverse-tail)) |
343 (if (null path) | 364 (setq rest (cdr rest))) |
344 (cons nil (nreverse reverse-tail)) | 365 (if (null rest) |
345 (cons (nreverse reverse-tail) (cdr path))))) | 366 (cons path nil) |
367 (cons (nreverse reverse-tail) (cdr rest))))) | |
346 | 368 |
347 (defun packages-find-packages (package-path &optional inhibit) | 369 (defun packages-find-packages (package-path &optional inhibit) |
348 "Search for all packages in PACKAGE-PATH. | 370 "Search for all packages in PACKAGE-PATH. |
349 PACKAGE-PATH may distinguish (by NIL-separation) between early | 371 PACKAGE-PATH may distinguish (by NIL-separation) between early, |
350 and late packages. | 372 late and last packages. |
351 If INHIBIT is non-NIL, return empty paths. | 373 If INHIBIT is non-NIL, return empty paths. |
352 This returns (CONS EARLY-PACKAGES LATE-PACKAGES)." | 374 This returns (LIST EARLY-PACKAGES LATE-PACKAGES LAST-PACKAGES)." |
353 (if inhibit | 375 (if inhibit |
354 (cons '() '()) | 376 (list '() '() '()) |
377 ;; When in doubt, it's late | |
355 (let* ((stuff (packages-split-path package-path)) | 378 (let* ((stuff (packages-split-path package-path)) |
356 (early (car stuff)) | 379 (early (and (cdr stuff) (car stuff))) |
357 (late (cdr stuff))) | 380 (late+last (or (cdr stuff) (car stuff))) |
358 (cons (packages-find-packages-in-directories early) | 381 (stuff (packages-split-path late+last)) |
359 (packages-find-packages-in-directories late))))) | 382 (late (car stuff)) |
383 (last (cdr stuff))) | |
384 (list (packages-find-packages-in-directories early) | |
385 (packages-find-packages-in-directories late) | |
386 (packages-find-packages-in-directories last))))) | |
360 | 387 |
361 (defun packages-find-package-library-path (packages suffixes) | 388 (defun packages-find-package-library-path (packages suffixes) |
362 "Construct a path into a component of the packages hierarchy. | 389 "Construct a path into a component of the packages hierarchy. |
363 PACKAGES is a list of package directories. | 390 PACKAGES is a list of package directories. |
364 SUFFIXES is a list of names of package subdirectories to look for." | 391 SUFFIXES is a list of names of package subdirectories to look for." |
422 preloaded-file-list) | 449 preloaded-file-list) |
423 (load file-name) | 450 (load file-name) |
424 ;; dumped-lisp.el could have set this ... | 451 ;; dumped-lisp.el could have set this ... |
425 (if package-lisp | 452 (if package-lisp |
426 (mapc #'(lambda (base) | 453 (mapc #'(lambda (base) |
427 (funcall handle (expand-file-name base dir))) | 454 (funcall handle base)) |
428 package-lisp)))))) | 455 package-lisp)))))) |
429 package-load-path)) | 456 package-load-path)) |
430 | 457 |
431 (defun packages-load-package-dumped-lisps (package-load-path) | 458 (defun packages-load-package-dumped-lisps (package-load-path) |
432 "Load dumped-lisp.el files along a load path. | 459 "Load dumped-lisp.el files along a load path. |
437 "Load dumped-lisp.el files along a load path. | 464 "Load dumped-lisp.el files along a load path. |
438 Return list of files off PACKAGE-LISP definitions there" | 465 Return list of files off PACKAGE-LISP definitions there" |
439 (let ((*files* '())) | 466 (let ((*files* '())) |
440 (packages-handle-package-dumped-lisps | 467 (packages-handle-package-dumped-lisps |
441 #'(lambda (file) | 468 #'(lambda (file) |
442 (setq *files* (cons (file-name-nondirectory file) | 469 (setq *files* (cons file *files*))) |
443 *files*))) | |
444 package-load-path) | 470 package-load-path) |
445 (reverse *files*))) | 471 (reverse *files*))) |
446 | 472 |
447 (provide 'packages) | 473 (provide 'packages) |
448 | 474 |