comparison lisp/packages.el @ 424:11054d720c21 r21-2-20

Import from CVS: tag r21-2-20
author cvs
date Mon, 13 Aug 2007 11:26:11 +0200
parents 41dbb7a9d5f2
children
comparison
equal deleted inserted replaced
423:28d9c139be4c 424:11054d720c21
82 "Packages last in the load path.") 82 "Packages last in the load path.")
83 83
84 (defvar last-package-load-path nil 84 (defvar last-package-load-path nil
85 "Load path for packages last in the load path.") 85 "Load path for packages last in the load path.")
86 86
87 (defvar package-locations 87 (defun packages-compute-package-locations (user-init-directory)
88 (list 88 "Compute locations of the various package directories.
89 (list (paths-construct-path '("~" ".xemacs" "mule-packages"))
90 'early #'(lambda () (featurep 'mule)))
91 (list (paths-construct-path '("~" ".xemacs" "xemacs-packages"))
92 'early #'(lambda () t))
93 (list "site-packages" 'late #'(lambda () t))
94 (list "infodock-packages" 'late #'(lambda () (featurep 'infodock)))
95 (list "mule-packages" 'late #'(lambda () (featurep 'mule)))
96 (list "xemacs-packages" 'late #'(lambda () t)))
97 "Locations of the various package directories.
98 This is a list each of whose elements describes one directory. 89 This is a list each of whose elements describes one directory.
99 A directory description is a three-element list. 90 A directory description is a three-element list.
100 The first element is either an absolute path or a subdirectory 91 The first element is either an absolute path or a subdirectory
101 in the XEmacs hierarchy. 92 in the XEmacs hierarchy.
102 The second component is one of the symbols EARLY, LATE, LAST, 93 The second component is one of the symbols EARLY, LATE, LAST,
103 depending on the load-path segment the hierarchy is supposed to 94 depending on the load-path segment the hierarchy is supposed to
104 show up in. 95 show up in.
105 The third component is a thunk which, if it returns NIL, causes 96 The third component is a thunk which, if it returns NIL, causes
106 the directory to be ignored.") 97 the directory to be ignored."
98 (list
99 (list (paths-construct-path (list user-init-directory "mule-packages"))
100 'early #'(lambda () (featurep 'mule)))
101 (list (paths-construct-path (list user-init-directory "xemacs-packages"))
102 'early #'(lambda () t))
103 (list "site-packages" 'late #'(lambda () t))
104 (list "infodock-packages" 'late #'(lambda () (featurep 'infodock)))
105 (list "mule-packages" 'late #'(lambda () (featurep 'mule)))
106 (list "xemacs-packages" 'late #'(lambda () t))))
107 107
108 (defun package-get-key-1 (info key) 108 (defun package-get-key-1 (info key)
109 "Locate keyword `key' in list." 109 "Locate keyword `key' in list."
110 (cond ((null info) 110 (cond ((null info)
111 nil) 111 nil)
427 (nconc packages 427 (nconc packages
428 (packages-find-packages-by-name roots name)))))) 428 (packages-find-packages-by-name roots name))))))
429 (setq package-locations (cdr package-locations))) 429 (setq package-locations (cdr package-locations)))
430 packages))) 430 packages)))
431 431
432 (defun packages-find-packages (roots) 432 (defun packages-find-packages (roots package-locations)
433 "Find the packages." 433 "Find the packages."
434 (let ((envvar-value (getenv "EMACSPACKAGEPATH"))) 434 (let ((envvar-value (getenv "EMACSPACKAGEPATH")))
435 (if envvar-value 435 (if envvar-value
436 (packages-split-package-path (paths-decode-directory-path envvar-value)) 436 (packages-split-package-path (paths-decode-directory-path envvar-value))
437 (packages-deconstruct 437 (packages-deconstruct
492 ;; Loading package initialization files 492 ;; Loading package initialization files
493 493
494 (defun packages-load-package-lisps (package-load-path base) 494 (defun packages-load-package-lisps (package-load-path base)
495 "Load all Lisp files of a certain name along a load path. 495 "Load all Lisp files of a certain name along a load path.
496 BASE is the base name of the files." 496 BASE is the base name of the files."
497 (mapc #'(lambda (dir) 497 (mapcar #'(lambda (dir)
498 (let ((file-name (expand-file-name base dir))) 498 (let ((file-name (expand-file-name base dir)))
499 (condition-case error 499 (condition-case error
500 (load file-name t t) 500 (load file-name t t)
501 (error 501 (error
502 (warn (format "Autoload error in: %s:\n\t%s" 502 (warn (format "Autoload error in: %s:\n\t%s"
511 (file-name-sans-extension autoload-file-name))) 511 (file-name-sans-extension autoload-file-name)))
512 512
513 (defun packages-handle-package-dumped-lisps (handle package-load-path) 513 (defun packages-handle-package-dumped-lisps (handle package-load-path)
514 "Load dumped-lisp.el files along a load path. 514 "Load dumped-lisp.el files along a load path.
515 Call HANDLE on each file off definitions of PACKAGE-LISP there." 515 Call HANDLE on each file off definitions of PACKAGE-LISP there."
516 (mapc #'(lambda (dir) 516 (mapcar #'(lambda (dir)
517 (let ((file-name (expand-file-name "dumped-lisp.el" dir))) 517 (let ((file-name (expand-file-name "dumped-lisp.el" dir)))
518 (if (file-exists-p file-name) 518 (if (file-exists-p file-name)
519 (let (package-lisp 519 (let (package-lisp
520 ;; 20.4 packages could set this 520 ;; 20.4 packages could set this
521 preloaded-file-list) 521 preloaded-file-list)
522 (load file-name) 522 (load file-name)
523 ;; dumped-lisp.el could have set this ... 523 ;; dumped-lisp.el could have set this ...
524 (if package-lisp 524 (if package-lisp
525 (mapc #'(lambda (base) 525 (mapcar #'(lambda (base)
526 (funcall handle base)) 526 (funcall handle base))
527 package-lisp)))))) 527 package-lisp))))))
528 package-load-path)) 528 package-load-path))
529 529
530 (defun packages-load-package-dumped-lisps (package-load-path) 530 (defun packages-load-package-dumped-lisps (package-load-path)