annotate lisp/packages.el @ 266:18d185df8c54

Added tag r20-5b31 for changeset 8efd647ea9ca
author cvs
date Mon, 13 Aug 2007 10:25:39 +0200
parents 405dd6d1825b
children 966663fcf606
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
1 ;;; packages.el --- Low level support for XEmacs packages
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
2
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
4
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
5 ;; Author: Steven L Baur <steve@altair.xemacs.org>
235
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
6 ;; Maintainer: Steven L Baur <steve@altair.xemacs.org>
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
7 ;; Keywords: internal, lisp, dumped
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
8
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
9 ;; This file is part of XEmacs.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
10
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
11 ;; XEmacs is free software; you can redistribute it and/or modify it
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
12 ;; under the terms of the GNU General Public License as published by
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
14 ;; any later version.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
15
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
16 ;; XEmacs is distributed in the hope that it will be useful, but
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
19 ;; General Public License for more details.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
20
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
22 ;; along with XEmacs; see the file COPYING. If not, write to the Free
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
24 ;; 02111-1307, USA.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
25
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
26 ;;; Synched up with: Not in FSF
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
27
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
28 ;;; Commentary:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
29
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
30 ;; This file is dumped with XEmacs.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
31
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
32 ;; This file provides low level facilities for XEmacs startup --
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
33 ;; particularly regarding the package setup. This code has to run in
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
34 ;; what we call "bare temacs" -- i.e. XEmacs without the usual Lisp
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
35 ;; environment. Pay special attention:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
36
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
37 ;; - not to use the `lambda' macro. Use #'(lambda ...) instead.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
38 ;; (this goes for any package loaded before `subr.el'.)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
39 ;;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
40 ;; - not to use macros, because they are not yet available (and this
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
41 ;; file must be loadable uncompiled.) This rules out CL-style
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
42 ;; macros like `when', for instance.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
43 ;;
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
44 ;; - not to use `defcustom'. If you must add user-customizable
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
45 ;; variables here, use `defvar', and add the variable to
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
46 ;; `cus-start.el'.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
47
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
48 ;; Because of all this, make sure that the stuff you put here really
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
49 ;; belongs here.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
50
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
51
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
52 ;;; Code:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
53
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
54 ;;; Package versioning
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
55
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
56 (defvar packages-package-list nil
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
57 "database of loaded packages and version numbers")
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
58
235
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
59 (defun package-get-key-1 (info key)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
60 "Locate keyword `key' in list."
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
61 (cond ((null info)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
62 nil)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
63 ((eq (car info) key)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
64 (nth 1 info))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
65 (t (package-get-key-1 (cddr info) key))))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
66
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
67 (defun package-get-key (name key)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
68 "Get info `key' from package `name'."
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
69 (let ((info (assq name packages-package-list)))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
70 (when info
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
71 (package-get-key-1 (cdr info) key))))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
72
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
73 (defun package-provide (name &rest attributes)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
74 (let ((info (if (and attributes (floatp (car attributes)))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
75 (list :version (car attributes))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
76 attributes)))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
77 (remassq name packages-package-list)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
78 (setq packages-package-list
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
79 (cons (cons name info) packages-package-list))))
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
80
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
81 (defun package-require (name version)
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
82 (let ((pkg (assq name packages-package-list)))
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
83 (cond ((null pkg)
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
84 (error "Package %s has not been loaded into this XEmacsen"
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
85 name))
239
41f2f0e326e9 Import from CVS: tag r20-5b18
cvs
parents: 237
diff changeset
86 ((< (package-get-key name :version) version)
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
87 (error "Need version %g of package %s, got version %g"
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
88 version name (cdr pkg)))
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
89 (t t))))
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
90
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
91 ;;; Build time stuff
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
92
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
93 (defvar autoload-file-name "auto-autoloads.el"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
94 "Filename that autoloads are expected to be found in.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
95
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
96 (defvar packages-hardcoded-lisp
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
97 '(
253
157b30c96d03 Import from CVS: tag r20-5b25
cvs
parents: 247
diff changeset
98 #+infodock "id-vers"
157b30c96d03 Import from CVS: tag r20-5b25
cvs
parents: 247
diff changeset
99 #+infodock "easymenu-id-xemacs"
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
100 )
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
101 "Lisp packages that are always dumped with XEmacs")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
102
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
103 (defvar packages-useful-lisp
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
104 '("bytecomp"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
105 "byte-optimize"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
106 "shadow"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
107 "cl-macs")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
108 "Lisp packages that need early byte compilation.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
109
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
110 (defvar packages-unbytecompiled-lisp
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
111 '("paths.el"
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
112 "dumped-lisp.el"
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
113 "dumped-pkg-lisp.el"
261
405dd6d1825b Import from CVS: tag r20-5b29
cvs
parents: 253
diff changeset
114 "version.el"
405dd6d1825b Import from CVS: tag r20-5b29
cvs
parents: 253
diff changeset
115 "Installation.el")
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
116 "Lisp packages that should not be byte compiled.")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
117
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
118
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
119 ;; Copied from help.el, could possibly move it to here permanently.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
120 ;; Unlike the FSF version, our `locate-library' uses the `locate-file'
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
121 ;; primitive, which should make it lightning-fast.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
122
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
123 (defun locate-library (library &optional nosuffix path interactive-call)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
124 "Show the precise file name of Emacs library LIBRARY.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
125 This command searches the directories in `load-path' like `M-x load-library'
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
126 to find the file that `M-x load-library RET LIBRARY RET' would load.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
127 Optional second arg NOSUFFIX non-nil means don't add suffixes `.elc' or `.el'
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
128 to the specified name LIBRARY.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
129
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
130 If the optional third arg PATH is specified, that list of directories
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
131 is used instead of `load-path'."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
132 (interactive (list (read-string "Locate library: ")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
133 nil nil
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
134 t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
135 (let ((result
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
136 (locate-file
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
137 library
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
138 (or path load-path)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
139 (cond ((or (rassq 'jka-compr-handler file-name-handler-alist)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
140 (and (boundp 'find-file-hooks)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
141 (member 'crypt-find-file-hook find-file-hooks)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
142 ;; Compression involved.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
143 (if nosuffix
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
144 ":.gz:.Z"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
145 ".elc:.elc.gz:elc.Z:.el:.el.gz:.el.Z::.gz:.Z"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
146 (t
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
147 ;; No compression.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
148 (if nosuffix
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
149 ""
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
150 ".elc:.el:")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
151 4)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
152 (and interactive-call
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
153 (if result
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
154 (message "Library is file %s" result)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
155 (message "No library %s in search path" library)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
156 result))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
157
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
158 (defun packages-add-suffix (str)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
159 (if (null (string-match "\\.el\\'" str))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
160 (concat str ".elc")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
161 str))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
162
235
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
163 (defun packages-list-autoloads-path ()
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
164 "List autoloads from precomputed load-path."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
165 (let ((path load-path)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
166 autoloads)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
167 (while path
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
168 (if (file-exists-p (concat (car path)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
169 autoload-file-name))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
170 (setq autoloads (cons (concat (car path)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
171 autoload-file-name)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
172 autoloads)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
173 (setq path (cdr path)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
174 autoloads))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
175
235
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
176 (defun packages-list-autoloads ()
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
177 "List autoload files in (what will be) the normal lisp search path.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
178 This function is used during build to find where the global symbol files so
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
179 they can be perused for their useful information."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
180 ;; Source directory may not be initialized yet.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
181 ;; (print (prin1-to-string load-path))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
182 (if (null source-directory)
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
183 (setq source-directory (concat (car load-path) "./")))
235
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
184 (let ((files (directory-files (file-name-as-directory source-directory)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
185 t ".*"))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
186 file autolist)
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
187 ;; (print (prin1-to-string source-directory))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
188 ;; (print (prin1-to-string files))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
189 (while (setq file (car-safe files))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
190 (if (and (file-directory-p file)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
191 (file-exists-p (concat file "/" autoload-file-name)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
192 (setq autolist (cons (concat file "/" autoload-file-name)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
193 autolist)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
194 (setq files (cdr files)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
195 autolist))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
196
235
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
197 ;; The following function cannot be called from a bare temacs
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
198 (defun packages-new-autoloads ()
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
199 "Return autoloads files that have been added or modified since XEmacs dump."
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
200 (require 'loadhist)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
201 (let ((me (concat invocation-directory invocation-name))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
202 (path load-path)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
203 result dir)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
204 (while path
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
205 (setq dir (file-truename (car path)))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
206 (let ((autoload-file (file-name-sans-extension (concat
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
207 dir
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
208 autoload-file-name))))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
209 ;; Check for:
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
210 ;; 1. An auto-autoload file that hasn't provided a feature (because
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
211 ;; it has been installed since XEmacs was dumped).
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
212 ;; 2. auto-autoload.el being newer than the executable
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
213 ;; 3. auto-autoload.elc being newer than the executable (the .el
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
214 ;; could be missing or compressed)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
215 (when (or (and (null (file-provides autoload-file))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
216 (or (file-exists-p (concat autoload-file ".elc"))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
217 (file-exists-p (concat autoload-file ".el"))))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
218 (and (file-newer-than-file-p (concat autoload-file ".el") me)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
219 (setq autoload-file (concat autoload-file ".el")))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
220 (and (file-newer-than-file-p (concat autoload-file
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
221 ".elc")
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
222 me)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
223 (setq autoload-file (concat autoload-file ".elc"))))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
224 (push autoload-file result)))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
225 (setq path (cdr path)))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
226 result))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
227
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
228 ;; The following function cannot be called from a bare temacs
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
229 (defun packages-reload-autoloads ()
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
230 "Reload new or updated auto-autoloads files.
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
231 This is an extremely dangerous function to call after the user-init-files
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
232 is run. Don't call it or you'll be sorry."
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
233 (let ((autoload-list (packages-new-autoloads)))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
234 (while autoload-list
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
235 (let* ((autoload-file (car autoload-list))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
236 (feature (car-safe (file-provides autoload-file))))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
237 (when feature
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
238 ;; (message "(unload-feature %S)" feature)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
239 (unload-feature feature))
237
89ec2bb86eea Import from CVS: tag r20-5b17
cvs
parents: 235
diff changeset
240 (condition-case nil
89ec2bb86eea Import from CVS: tag r20-5b17
cvs
parents: 235
diff changeset
241 (load autoload-file)
89ec2bb86eea Import from CVS: tag r20-5b17
cvs
parents: 235
diff changeset
242 (t nil)))
235
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
243 (setq autoload-list (cdr autoload-list)))))
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
244
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
245 ;; The following function cannot be called from a bare temacs
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
246 (defun packages-reload-dumped-lisp ()
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
247 "Reload new or updated dumped lisp files (with exceptions).
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
248 This is an extremely dangerous function to call at any time."
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
249 ;; Nothing for the moment
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
250 nil)
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
251
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
252 ;; The following function is called from temacs
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
253 (defun packages-find-packages-1 (package path-only append-p user-package)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
254 "Search the supplied directory for associated directories.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
255 The top level is assumed to look like:
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
256 info/ Contain texinfo files for lisp installed in this hierarchy
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 239
diff changeset
257 etc/ Contain data files for lisp installled in this hierarchy
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
258 lisp/ Contain directories which either have straight lisp code
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
259 or are self-contained packages of their own.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
260
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
261 If the argument `append-p' is non-nil, the found directories will be
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
262 appended to the paths, otherwise, they will be prepended.
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
263
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
264 This is an internal function. Do not call it after startup."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
265 ;; Info files
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
266 (if (and (null path-only) (file-directory-p (concat package "/info")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
267 (let ((dir (concat package "/info/")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
268 (if (not (member dir Info-default-directory-list))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
269 (nconc Info-default-directory-list (list dir)))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
270 ;; Data files
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
271 (if (and (null path-only) (file-directory-p (concat package "/etc")))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
272 (setq data-directory-list
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
273 (if append-p
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
274 (append data-directory-list (list (concat package "/etc/")))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
275 (cons (concat package "/etc/") data-directory-list))))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
276 ;; Lisp files
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
277 (if (file-directory-p (concat package "/lisp"))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
278 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
279 ; (print (concat "DIR: "
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
280 ; (if user-package "[USER]" "")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
281 ; package
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
282 ; "/lisp/"))
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
283 (setq load-path
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
284 (if append-p
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
285 (append load-path (list (concat package "/lisp/")))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
286 (cons (concat package "/lisp/") load-path)))
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
287
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
288 ;; Locate and process a dumped-lisp.el file if it exists
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
289 (if (and (running-temacs-p)
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
290 (file-exists-p (concat package "/lisp/dumped-lisp.el")))
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
291 (let (package-lisp)
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 239
diff changeset
292 (let (preloaded-file-list)
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 239
diff changeset
293 (load (concat package "/lisp/dumped-lisp.el")))
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
294 (if package-lisp
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
295 (progn
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
296 (if (boundp 'preloaded-file-list)
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
297 (setq preloaded-file-list
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
298 (append preloaded-file-list package-lisp)))
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
299 (if (fboundp 'load-gc)
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
300 (setq dumped-lisp-packages
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
301 (append dumped-lisp-packages package-lisp)))))))
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
302
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
303 (if user-package
233
52952cbfc5b5 Import from CVS: tag r20-5b15
cvs
parents: 227
diff changeset
304 (condition-case error
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
305 (load (concat package "/lisp/"
233
52952cbfc5b5 Import from CVS: tag r20-5b15
cvs
parents: 227
diff changeset
306 (file-name-sans-extension autoload-file-name))
52952cbfc5b5 Import from CVS: tag r20-5b15
cvs
parents: 227
diff changeset
307 t)
52952cbfc5b5 Import from CVS: tag r20-5b15
cvs
parents: 227
diff changeset
308 (error
52952cbfc5b5 Import from CVS: tag r20-5b15
cvs
parents: 227
diff changeset
309 (warn (format "Autoload error in: %s/lisp/:\n\t%s"
52952cbfc5b5 Import from CVS: tag r20-5b15
cvs
parents: 227
diff changeset
310 package
52952cbfc5b5 Import from CVS: tag r20-5b15
cvs
parents: 227
diff changeset
311 (with-output-to-string
52952cbfc5b5 Import from CVS: tag r20-5b15
cvs
parents: 227
diff changeset
312 (display-error error nil)))))))
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
313 (let ((dirs (directory-files (concat package "/lisp/")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
314 t "^[^-.]" nil 'dirs-only))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
315 dir)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
316 (while dirs
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
317 (setq dir (car dirs))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
318 ; (print (concat "DIR: " dir "/"))
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
319 (setq load-path
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
320 (if append-p
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
321 (append load-path (list (concat dir "/")))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
322 (cons (concat dir "/") load-path)))
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
323
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
324 ;; Locate and process a dumped-lisp.el file if it exists
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
325 (if (and (running-temacs-p)
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
326 (file-exists-p (concat dir "/dumped-lisp.el")))
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
327 (let (package-lisp)
247
e70b3a057e12 Import from CVS: tag r20-5b22
cvs
parents: 243
diff changeset
328 (let (preloaded-file-list)
e70b3a057e12 Import from CVS: tag r20-5b22
cvs
parents: 243
diff changeset
329 (load (concat dir "/dumped-lisp.el")))
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
330 (if package-lisp
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
331 (progn
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
332 (if (boundp 'preloaded-file-list)
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
333 (setq preloaded-file-list
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
334 (append preloaded-file-list package-lisp)))
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
335 (if (fboundp 'load-gc)
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
336 (setq dumped-lisp-packages
235
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
337 (append dumped-lisp-packages
85a06df23a9a Import from CVS: tag r20-5b16
cvs
parents: 233
diff changeset
338 package-lisp)))))))
227
0e522484dd2a Import from CVS: tag r20-5b12
cvs
parents: 217
diff changeset
339
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
340 (if user-package
233
52952cbfc5b5 Import from CVS: tag r20-5b15
cvs
parents: 227
diff changeset
341 (condition-case error
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
342 (progn
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
343 ; (print
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
344 ; (concat dir "/"
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
345 ; (file-name-sans-extension autoload-file-name)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
346 (load
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
347 (concat dir "/"
233
52952cbfc5b5 Import from CVS: tag r20-5b15
cvs
parents: 227
diff changeset
348 (file-name-sans-extension autoload-file-name))
52952cbfc5b5 Import from CVS: tag r20-5b15
cvs
parents: 227
diff changeset
349 t))
52952cbfc5b5 Import from CVS: tag r20-5b15
cvs
parents: 227
diff changeset
350 (error
52952cbfc5b5 Import from CVS: tag r20-5b15
cvs
parents: 227
diff changeset
351 (warn (format "Autoload error in: %s/:\n\t%s"
52952cbfc5b5 Import from CVS: tag r20-5b15
cvs
parents: 227
diff changeset
352 dir
52952cbfc5b5 Import from CVS: tag r20-5b15
cvs
parents: 227
diff changeset
353 (with-output-to-string
52952cbfc5b5 Import from CVS: tag r20-5b15
cvs
parents: 227
diff changeset
354 (display-error error nil)))))))
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
355 (packages-find-packages-1 dir path-only append-p user-package)
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
356 (setq dirs (cdr dirs)))))))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
357
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
358 ;; The following function is called from temacs
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
359 (defun packages-find-packages-2 (path path-only append-p suppress-user)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
360 "Search the supplied path for associated directories.
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
361 If the argument `append-p' is non-nil, the found directories will be
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
362 appended to the paths, otherwise, they will be prepended.
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
363
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
364 This is an internal function. Do not call it after startup."
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
365 (let (dir)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
366 (while path
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
367 (setq dir (car path))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
368 ;; (prin1 (concat "Find: " (expand-file-name dir) "\n"))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
369 (if (null (and (or suppress-user inhibit-package-init)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
370 (string-match "^~" dir)))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
371 (progn
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
372 ;; (print dir)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
373 (packages-find-packages-1 (expand-file-name dir)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
374 path-only
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
375 append-p
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
376 (string-match "^~" dir))))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
377 (setq path (cdr path)))))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
378
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
379 ;; The following function is called from temacs
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
380 (defun packages-find-packages (pkg-path path-only &optional suppress-user)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
381 "Search the supplied path for additional info/etc/lisp directories.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
382 Lisp directories if configured prior to build time will have equivalent
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
383 status as bundled packages.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
384 If the argument `path-only' is non-nil, only the `load-path' will be set,
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
385 otherwise data directories and info directories will be added.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
386 If the optional argument `suppress-user' is non-nil, package directories
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
387 rooted in a user login directory (like ~/.xemacs) will not be searched.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
388 This is used at dump time to suppress the builder's local environment."
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
389 (let ((prefix-path nil))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
390 (while (and pkg-path (car pkg-path))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
391 (setq prefix-path (cons (car pkg-path) prefix-path)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
392 pkg-path (cdr pkg-path)))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
393 (packages-find-packages-2 (cdr pkg-path) path-only t suppress-user)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
394 (packages-find-packages-2 prefix-path path-only nil suppress-user)))
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
395
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
396
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
397 ;; Data-directory is really a list now. Provide something to search it for
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
398 ;; directories.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
399
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
400 (defun locate-data-directory (name &optional dir-list)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
401 "Locate a directory in a search path DIR-LIST (a list of directories).
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
402 If no DIR-LIST is supplied, it defaults to `data-directory-list'."
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
403 (unless dir-list
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
404 (setq dir-list data-directory-list))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
405 (let (found found-dir)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
406 (while (and (null found-dir) dir-list)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
407 (setq found (concat (car dir-list) name "/")
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
408 found-dir (file-directory-p found))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
409 (or found-dir
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
410 (setq found nil))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
411 (setq dir-list (cdr dir-list)))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
412 found))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
413
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
414 ;; Data-directory is really a list now. Provide something to search it for
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
415 ;; files.
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
416
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
417 (defun locate-data-file (name &optional dir-list)
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
418 "Locate a file in a search path DIR-LIST (a list of directories).
239
41f2f0e326e9 Import from CVS: tag r20-5b18
cvs
parents: 237
diff changeset
419 If no DIR-LIST is supplied, it defaults to `data-directory-list'.
41f2f0e326e9 Import from CVS: tag r20-5b18
cvs
parents: 237
diff changeset
420 This function is basically a wrapper over `locate-file'."
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
421 (unless dir-list
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
422 (setq dir-list data-directory-list))
239
41f2f0e326e9 Import from CVS: tag r20-5b18
cvs
parents: 237
diff changeset
423 (locate-file name dir-list))
215
1f0dabaa0855 Import from CVS: tag r20-4b6
cvs
parents: 213
diff changeset
424
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
425 ;; If we are being loaded as part of being dumped, bootstrap the rest of the
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
426 ;; load-path for loaddefs.
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
427 (if (fboundp 'load-gc)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
428 (packages-find-packages package-path t t))
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
429
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
430 (provide 'packages)
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
431
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents:
diff changeset
432 ;;; packages.el ends here