Mercurial > hg > xemacs-beta
comparison lisp/setup-paths.el @ 2456:f4e405a9d18d
[xemacs-hg @ 2004-12-27 12:25:14 by michaels]
2004-12-18 Mike Sperber <mike@xemacs.org>
* package-admin.el:
* startup.el: Reflect the changes made in packages.el.
* packages.el:
* loadup.el:
* make-docfile.el:
* package-admin.el:
* startup.el:
* update-elc.el (early-package-hierarchies)
(late-package-hierarchies)
(last-package-hierarchies): Renamed these from `early-packages',
`late-packages' and `last-packages'.
* packages.el: Rewrote package-finding logic to separate the
concepts of "package directories" and "package hierarchies".
Added explanation of these concepts.
* setup-paths.el:
* find-paths.el: Added parameter descriptions to some of the
docstrings.
* packages.el, setup-paths.el: Make terminology more explicit
about "package hierarchies"
* startup.el (emacs-roots, emacs-data-roots)
(user-init-directory-base, user-init-directory)
(user-init-file-base, user-init-file-base-list)
(user-home-init-file-base-list)
(load-home-init-file, load-user-init-file-p)
(startup-find-load-path, startup-setup-paths)
(startup-find-load-path-for-packages): Moved these back from
setup-paths.el where they belong---setup-paths.el now again, as
documented, contains no code that sets global variables. (They
were moved from startup.el to setup-paths.el on 2003-02-28.)
Clarify that in the comment at the top.
* setup-paths.el (paths-find-emacs-roots): Restored
`invocation-directory' 'invocation-name' parameters removed on
2003-02-28; they're useful for debugging.
author | michaels |
---|---|
date | Mon, 27 Dec 2004 12:27:05 +0000 |
parents | 8b284a83dd90 |
children | 57711e9aac15 |
comparison
equal
deleted
inserted
replaced
2455:3e06061baa0e | 2456:f4e405a9d18d |
---|---|
3 ;; Copyright (C) 1985-1986, 1990, 1992-1997 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1985-1986, 1990, 1992-1997 Free Software Foundation, Inc. |
4 ;; Copyright (c) 1993, 1994 Sun Microsystems, Inc. | 4 ;; Copyright (c) 1993, 1994 Sun Microsystems, Inc. |
5 ;; Copyright (C) 1995 Board of Trustees, University of Illinois | 5 ;; Copyright (C) 1995 Board of Trustees, University of Illinois |
6 ;; Copyright (C) 2003 Ben Wing. | 6 ;; Copyright (C) 2003 Ben Wing. |
7 | 7 |
8 ;; Author: Mike Sperber <sperber@informatik.uni-tuebingen.de> | 8 ;; Author: Mike Sperber <mike@xemacs.orgx> |
9 ;; Maintainer: XEmacs Development Team | 9 ;; Maintainer: XEmacs Development Team |
10 ;; Keywords: internal, dumped | 10 ;; Keywords: internal, dumped |
11 | 11 |
12 ;; This file is part of XEmacs. | 12 ;; This file is part of XEmacs. |
13 | 13 |
32 | 32 |
33 ;; This file is dumped with XEmacs. | 33 ;; This file is dumped with XEmacs. |
34 | 34 |
35 ;; This file contains functions and variables that describe and construct | 35 ;; This file contains functions and variables that describe and construct |
36 ;; the various paths into the XEmacs hierarchy from a global viewpoint. | 36 ;; the various paths into the XEmacs hierarchy from a global viewpoint. |
37 ;; This file doesn't actually do anything. | 37 |
38 ;; This file doesn't actually set any global variable, and doesn't | |
39 ;; contain any state---it just contains the functionality for | |
40 ;; searching directories and constructing paths. | |
38 | 41 |
39 ;; It requires find-paths.el and packages.el. | 42 ;; It requires find-paths.el and packages.el. |
40 | 43 |
41 ;;; Code: | 44 ;;; Code: |
42 | 45 |
43 ;(setq debug-paths t) | 46 ;(setq debug-paths t) |
44 | 47 |
45 | 48 |
46 ;;; Path-related variables. | |
47 ;;; NOTE: Many of them (`lisp-directory', `data-directory', etc.) are | |
48 ;;; built-in. | |
49 | |
50 (defvar emacs-roots nil | |
51 "List of plausible roots of the XEmacs hierarchy. | |
52 This is a list of plausible directories in which to search for the important | |
53 directories used by XEmacs at run-time, for example `exec-directory', | |
54 `data-directory' and `lisp-directory'. | |
55 | |
56 Normally set at startup by calling `paths-find-emacs-roots'.") | |
57 | |
58 (defvar emacs-data-roots nil | |
59 "List of plausible data roots of the XEmacs hierarchy.") | |
60 | |
61 (defvar user-init-directory-base ".xemacs" | |
62 "Base of directory where user-installed init files may go.") | |
63 | |
64 (defvar user-init-directory | |
65 (file-name-as-directory | |
66 (paths-construct-path (list "~" user-init-directory-base))) | |
67 "Directory where user-installed init files may go.") | |
68 | |
69 (defvar user-init-file-base "init.el" | |
70 "Default name of the user init file if uncompiled. | |
71 This should be used for migration purposes only.") | |
72 | |
73 (defvar user-init-file-base-list '("init.el") | |
74 "List of allowed init files in the user's init directory. | |
75 The first one found takes precedence. .elc files do not need to be listed.") | |
76 | |
77 (defvar user-home-init-file-base-list | |
78 (append '(".emacs.el" ".emacs") | |
79 (and (eq system-type 'windows-nt) | |
80 '("_emacs.el" "_emacs"))) | |
81 "List of allowed init files in the user's home directory. | |
82 The first one found takes precedence. .elc files do not need to be listed.") | |
83 | |
84 (defvar load-home-init-file nil | |
85 "Non-nil if XEmacs should load the init file from the home directory. | |
86 Otherwise, XEmacs will offer migration to the init directory.") | |
87 | |
88 (defvar load-user-init-file-p t | |
89 "Non-nil if XEmacs should load the user's init file.") | |
90 | |
91 (defvar paths-core-load-path-depth 0 | 49 (defvar paths-core-load-path-depth 0 |
92 "Depth of load-path searches in core Lisp paths.") | 50 "Depth of load-path searches in core Lisp paths.") |
93 | 51 |
94 (defvar paths-site-load-path-depth 1 | 52 (defvar paths-site-load-path-depth 1 |
95 "Depth of load-path searches in site Lisp paths.") | 53 "Depth of load-path searches in site Lisp paths.") |
128 (or configure-data-directory (paths-file-readable-directory-p (paths-construct-path (list directory "etc"))))))) | 86 (or configure-data-directory (paths-file-readable-directory-p (paths-construct-path (list directory "etc"))))))) |
129 | 87 |
130 (defun paths-emacs-data-root-p (directory) | 88 (defun paths-emacs-data-root-p (directory) |
131 "Check if DIRECTORY is a plausible data installation root. | 89 "Check if DIRECTORY is a plausible data installation root. |
132 A data installation root is one containing data files that may be shared | 90 A data installation root is one containing data files that may be shared |
133 among multiple different versions of XEmacs, the packages in particular." | 91 among multiple different versions of XEmacs, the packages in particular. |
92 This serves as an additional filter to narrow down the list of plausible | |
93 installation roots." | |
134 (or | 94 (or |
135 ;; installed | 95 ;; installed |
136 (paths-file-readable-directory-p (paths-construct-path (list directory | 96 (paths-file-readable-directory-p (paths-construct-path (list directory |
137 "lib" | 97 "lib" |
138 emacs-program-name))) | 98 emacs-program-name))) |
143 (and | 103 (and |
144 (paths-file-readable-directory-p (paths-construct-path (list directory "lisp"))) | 104 (paths-file-readable-directory-p (paths-construct-path (list directory "lisp"))) |
145 (paths-file-readable-directory-p (paths-construct-path (list directory "etc")))))) | 105 (paths-file-readable-directory-p (paths-construct-path (list directory "etc")))))) |
146 | 106 |
147 (defun paths-find-emacs-root (invocation-directory invocation-name) | 107 (defun paths-find-emacs-root (invocation-directory invocation-name) |
148 "Find the run-time root of XEmacs." | 108 "Find the run-time root of XEmacs. |
109 INVOCATION-DIRECTORY is a directory containing the XEmacs executable. | |
110 INVOCATION-NAME is the name of the executable itself." | |
149 (let* ((executable-file-name (paths-chase-symlink | 111 (let* ((executable-file-name (paths-chase-symlink |
150 (concat invocation-directory | 112 (concat invocation-directory |
151 invocation-name))) | 113 invocation-name))) |
152 (executable-directory (file-name-directory executable-file-name)) | 114 (executable-directory (file-name-directory executable-file-name)) |
153 (maybe-root-1 (file-name-as-directory | 115 (maybe-root-1 (file-name-as-directory |
157 (or (and (paths-emacs-root-p maybe-root-1) | 119 (or (and (paths-emacs-root-p maybe-root-1) |
158 maybe-root-1) | 120 maybe-root-1) |
159 (and (paths-emacs-root-p maybe-root-2) | 121 (and (paths-emacs-root-p maybe-root-2) |
160 maybe-root-2)))) | 122 maybe-root-2)))) |
161 | 123 |
162 (defun paths-find-emacs-roots (root-p) | 124 (defun paths-find-emacs-roots (invocation-directory |
125 invocation-name | |
126 root-p) | |
163 "Find all plausible installation roots for XEmacs. | 127 "Find all plausible installation roots for XEmacs. |
164 This is a list of plausible directories in which to search for the important | 128 This is a list of plausible directories in which to search for the important |
165 directories used by XEmacs at run-time, for example `exec-directory', | 129 directories used by XEmacs at run-time, for example `exec-directory', |
166 `data-directory' and `lisp-directory'. | 130 `data-directory' and `lisp-directory'. |
167 ROOT-P is a function that tests whether a root is plausible." | 131 ROOT-P is a function that tests whether a root is plausible." |
182 (paths-filter root-p potential-installation-roots))) | 146 (paths-filter root-p potential-installation-roots))) |
183 (paths-uniq-append invocation-roots | 147 (paths-uniq-append invocation-roots |
184 installation-roots))) | 148 installation-roots))) |
185 | 149 |
186 (defun paths-find-site-lisp-directory (roots) | 150 (defun paths-find-site-lisp-directory (roots) |
187 "Find the site Lisp directory of the XEmacs hierarchy." | 151 "Find the site Lisp directory of the XEmacs hierarchy. |
152 ROOTS is a list of installation roots." | |
188 (paths-find-site-directory roots "site-lisp" | 153 (paths-find-site-directory roots "site-lisp" |
189 nil | 154 nil |
190 configure-site-directory)) | 155 configure-site-directory)) |
191 | 156 |
192 (defun paths-find-site-module-directory (roots) | 157 (defun paths-find-site-module-directory (roots) |
193 "Find the site modules directory of the XEmacs hierarchy." | 158 "Find the site modules directory of the XEmacs hierarchy. |
159 ROOTS is a list of installation roots." | |
194 (paths-find-site-directory roots "site-modules" | 160 (paths-find-site-directory roots "site-modules" |
195 nil | 161 nil |
196 configure-site-module-directory)) | 162 configure-site-module-directory)) |
197 | 163 |
198 (defun paths-find-lisp-directory (roots) | 164 (defun paths-find-lisp-directory (roots) |
199 "Find the main Lisp directory of the XEmacs hierarchy." | 165 "Find the main Lisp directory of the XEmacs hierarchy. |
166 ROOTS is a list of installation roots." | |
200 (paths-find-version-directory roots "lisp" | 167 (paths-find-version-directory roots "lisp" |
201 nil | 168 nil |
202 configure-lisp-directory)) | 169 configure-lisp-directory)) |
203 | 170 |
204 (defun paths-find-mule-lisp-directory (roots &optional lisp-directory) | 171 (defun paths-find-mule-lisp-directory (roots &optional lisp-directory) |
205 "Find the Mule Lisp directory of the XEmacs hierarchy." | 172 "Find the Mule Lisp directory of the XEmacs hierarchy. |
173 ROOTS is a list of installation roots." | |
206 ;; #### kludge | 174 ;; #### kludge |
207 (if lisp-directory | 175 (if lisp-directory |
208 (let ((guess | 176 (let ((guess |
209 (file-name-as-directory | 177 (file-name-as-directory |
210 (paths-construct-path (list lisp-directory "mule"))))) | 178 (paths-construct-path (list lisp-directory "mule"))))) |
213 (paths-find-version-directory roots "mule-lisp" | 181 (paths-find-version-directory roots "mule-lisp" |
214 nil | 182 nil |
215 configure-mule-lisp-directory))))) | 183 configure-mule-lisp-directory))))) |
216 | 184 |
217 (defun paths-find-module-directory (roots) | 185 (defun paths-find-module-directory (roots) |
218 "Find the main modules directory of the XEmacs hierarchy." | 186 "Find the main modules directory of the XEmacs hierarchy. |
187 ROOTS is a list of installation roots." | |
219 (paths-find-architecture-directory roots "modules" | 188 (paths-find-architecture-directory roots "modules" |
220 nil configure-module-directory)) | 189 nil configure-module-directory)) |
221 | 190 |
222 (defun paths-construct-load-path | 191 (defun paths-construct-load-path |
223 (roots early-package-load-path late-package-load-path last-package-load-path | 192 (roots early-package-load-path late-package-load-path last-package-load-path |
224 lisp-directory | 193 lisp-directory |
225 &optional site-lisp-directory mule-lisp-directory) | 194 &optional site-lisp-directory mule-lisp-directory) |
226 "Construct the load path." | 195 "Construct the complete load path. |
196 ROOTS is the list of installation roots. | |
197 EARLY-PACKAGE-LOAD-PATH, LATE-PACKAGE-LOAD-PATH, and LAST-PACKAGE-LOAD-PATH | |
198 are the load paths for the package hierarchies. | |
199 SITE-LISP-DIRECTORY and MULE-LISP-DIRECTORY are optional directories to be | |
200 included in the load path---SITE-LISP-DIRECTORY for the obsolete site-specific | |
201 Lisp files, and MULE-LISP-DIRECTORY for the Mule Lisp files, which exist | |
202 only in Mule installations." | |
227 (let* ((envvar-value (getenv "EMACSLOADPATH")) | 203 (let* ((envvar-value (getenv "EMACSLOADPATH")) |
228 (env-load-path | 204 (env-load-path |
229 (and envvar-value | 205 (and envvar-value |
230 (paths-decode-directory-path envvar-value 'drop-empties))) | 206 (paths-decode-directory-path envvar-value 'drop-empties))) |
231 (site-lisp-load-path | 207 (site-lisp-load-path |
261 paths-site-load-path-depth))) | 237 paths-site-load-path-depth))) |
262 (module-load-path | 238 (module-load-path |
263 (and module-directory | 239 (and module-directory |
264 (paths-find-recursive-load-path (list module-directory) | 240 (paths-find-recursive-load-path (list module-directory) |
265 paths-core-load-path-depth)))) | 241 paths-core-load-path-depth)))) |
266 (append env-module-path | 242 (append env-module-path |
267 site-module-load-path | 243 site-module-load-path |
268 module-load-path))) | 244 module-load-path))) |
269 | 245 |
270 (defun paths-construct-info-path (roots early-packages late-packages last-packages) | 246 (defun paths-construct-info-path (roots |
271 "Construct the info path." | 247 early-package-hierarchies |
248 late-package-hierarchies | |
249 last-package-hierarchies) | |
250 "Construct the info path. | |
251 ROOTS is the list of installation roots. | |
252 EARLY-PACKAGE-HIERARCHIES, LATE-PACKAGE-HIERARCHIES, and | |
253 LAST-PACKAGE-HIERARCHIES are lists of package hierarchy roots, | |
254 respectively." | |
272 (let ((info-path-envval (getenv "INFOPATH"))) | 255 (let ((info-path-envval (getenv "INFOPATH"))) |
273 (paths-uniq-append | 256 (paths-uniq-append |
274 (append | 257 (append |
275 (let ((info-directory | 258 (let ((info-directory |
276 (paths-find-version-directory roots "info" | 259 (paths-find-version-directory roots "info" |
277 nil | 260 nil |
278 configure-info-directory))) | 261 configure-info-directory))) |
279 (and info-directory | 262 (and info-directory |
280 (list info-directory))) | 263 (list info-directory))) |
281 (packages-find-package-info-path early-packages) | 264 (packages-find-package-info-path early-package-hierarchies) |
282 (packages-find-package-info-path late-packages) | 265 (packages-find-package-info-path late-package-hierarchies) |
283 (packages-find-package-info-path last-packages) | 266 (packages-find-package-info-path last-package-hierarchies) |
284 (and info-path-envval | 267 (and info-path-envval |
285 (paths-decode-directory-path info-path-envval 'drop-empties))) | 268 (paths-decode-directory-path info-path-envval 'drop-empties))) |
286 (and (null info-path-envval) | 269 (and (null info-path-envval) |
287 (paths-uniq-append | 270 (paths-uniq-append |
288 (paths-directories-which-exist configure-info-path) | 271 (paths-directories-which-exist configure-info-path) |
289 (paths-directories-which-exist paths-default-info-directories)))))) | 272 (paths-directories-which-exist paths-default-info-directories)))))) |
290 | 273 |
291 (defun paths-find-doc-directory (roots) | 274 (defun paths-find-doc-directory (roots) |
292 "Find the documentation directory." | 275 "Find the documentation directory. |
276 ROOTS is the list of installation roots." | |
293 (paths-find-architecture-directory roots "lib-src" nil configure-doc-directory)) | 277 (paths-find-architecture-directory roots "lib-src" nil configure-doc-directory)) |
294 | 278 |
295 (defun paths-find-exec-directory (roots) | 279 (defun paths-find-exec-directory (roots) |
296 "Find the binary directory." | 280 "Find the binary directory. |
281 ROOTS is the list of installation roots." | |
297 (paths-find-architecture-directory roots "lib-src" | 282 (paths-find-architecture-directory roots "lib-src" |
298 nil configure-exec-directory)) | 283 nil configure-exec-directory)) |
299 | 284 |
300 (defun paths-construct-exec-path (roots exec-directory | 285 (defun paths-construct-exec-path (roots exec-directory |
301 early-packages late-packages last-packages) | 286 early-package-hierarchies |
302 "Find the binary path." | 287 late-package-hierarchies |
288 last-package-hierarchies) | |
289 "Find the binary path. | |
290 ROOTS is the list of installation roots. | |
291 EARLY-PACKAGE-HIERARCHIES, LATE-PACKAGE-HIERARCHIES, and | |
292 LAST-PACKAGE-HIERARCHIES are lists of package hierarchy roots, | |
293 respectively. | |
294 EXEC-DIRECTORY is the directory of architecture-dependent files that | |
295 come with XEmacs. | |
296 EARLY-PACKAGES, LATE-PACKAGES, and LAST-PACKAGES are lists of | |
297 package hierarchy roots, respectively." | |
303 (append | 298 (append |
304 (let ((path-envval (getenv "PATH"))) | 299 (let ((path-envval (getenv "PATH"))) |
305 (if path-envval | 300 (if path-envval |
306 (paths-decode-directory-path path-envval 'drop-empties))) | 301 (paths-decode-directory-path path-envval 'drop-empties))) |
307 (packages-find-package-exec-path early-packages) | 302 (packages-find-package-exec-path early-package-hierarchies) |
308 (packages-find-package-exec-path late-packages) | 303 (packages-find-package-exec-path late-package-hierarchies) |
309 (let ((emacspath-envval (getenv "EMACSPATH"))) | 304 (let ((emacspath-envval (getenv "EMACSPATH"))) |
310 (and emacspath-envval | 305 (and emacspath-envval |
311 (split-path emacspath-envval))) | 306 (split-path emacspath-envval))) |
312 (and exec-directory | 307 (and exec-directory |
313 (list exec-directory)) | 308 (list exec-directory)) |
314 (packages-find-package-exec-path last-packages))) | 309 (packages-find-package-exec-path last-package-hierarchies))) |
315 | 310 |
316 (defun paths-find-data-directory (roots) | 311 (defun paths-find-data-directory (roots) |
317 "Find the data directory." | 312 "Find the data directory. |
313 ROOTS is the list of installation roots." | |
318 (paths-find-version-directory roots "etc" "EMACSDATA" configure-data-directory)) | 314 (paths-find-version-directory roots "etc" "EMACSDATA" configure-data-directory)) |
319 | 315 |
320 (defun paths-construct-data-directory-list (data-directory | 316 (defun paths-construct-data-directory-list (data-directory |
321 early-packages late-packages last-packages) | 317 early-package-hierarchies |
322 "Find the data path." | 318 late-package-hierarchies |
319 last-package-hierarchies) | |
320 "Construct the data path. | |
321 DATA-DIRECTORY is the data directory of the XEmacs installation. | |
322 EARLY-PACKAGE-HIERARCHIES, LATE-PACKAGE-HIERARCHIES, and | |
323 LAST-PACKAGE-HIERARCHIES are lists of package hierarchy roots, | |
324 respectively." | |
323 (append | 325 (append |
324 (packages-find-package-data-path early-packages) | 326 (packages-find-package-data-path early-package-hierarchies) |
325 (packages-find-package-data-path late-packages) | 327 (packages-find-package-data-path late-package-hierarchies) |
326 (list data-directory) | 328 (list data-directory) |
327 (packages-find-package-data-path last-packages))) | 329 (packages-find-package-data-path last-package-hierarchies))) |
328 | |
329 | |
330 ;;; High-level functions to set up the paths. | |
331 | |
332 (defun startup-find-load-path (&optional inhibit-packages | |
333 set-global-package-paths) | |
334 "Determine the value for `load-path'. | |
335 INHIBIT-PACKAGES says which types of packages, if any, to omit from the | |
336 returned value. It can be `t' (omit all), one of the symbols `early', | |
337 `late', or `last', or a list of one or more of the symbols. | |
338 | |
339 If SET-GLOBAL-PACKAGE-PATHS is non-nil, initialize the global package path | |
340 variables referring to the particular types of packages (`early-packages', | |
341 `early-package-load-path', `late-packages', `late-package-load-path', | |
342 `last-packages', `last-package-load-path')." | |
343 (let (earlyp latep lastp earlyp-lp latep-lp lastp-lp) | |
344 (apply #'(lambda (early late last) | |
345 (setq earlyp (and (not (memq 'early inhibit-packages)) early)) | |
346 (setq latep (and (not (memq 'late inhibit-packages)) late)) | |
347 (setq lastp (and (not (memq 'last inhibit-packages)) last))) | |
348 (packages-find-packages | |
349 emacs-data-roots | |
350 (packages-compute-package-locations user-init-directory))) | |
351 | |
352 (setq earlyp-lp (packages-find-package-load-path earlyp)) | |
353 (setq latep-lp (packages-find-package-load-path latep)) | |
354 (setq lastp-lp (packages-find-package-load-path lastp)) | |
355 | |
356 (when set-global-package-paths | |
357 (setq early-packages earlyp | |
358 late-packages latep | |
359 last-packages lastp | |
360 early-package-load-path earlyp-lp | |
361 late-package-load-path latep-lp | |
362 last-package-load-path lastp-lp)) | |
363 | |
364 (paths-construct-load-path emacs-roots earlyp-lp latep-lp lastp-lp | |
365 lisp-directory site-directory | |
366 mule-lisp-directory))) | |
367 | |
368 (defun startup-setup-paths (&optional inhibit-packages called-early) | |
369 "Setup all the various paths. | |
370 INHIBIT-PACKAGES says which types of packages, if any, to omit from the | |
371 returned value. It can be `t' (omit all), one of the symbols `early', | |
372 `late', or `last', or a list of one or more of the symbols. | |
373 | |
374 This function is idempotent, so call this as often as you like!" | |
375 | |
376 (setq debug-paths (or debug-paths | |
377 (and (getenv "EMACSDEBUGPATHS") | |
378 t))) | |
379 | |
380 (setq emacs-roots (paths-find-emacs-roots #'paths-emacs-data-root-p)) | |
381 | |
382 (setq emacs-data-roots (paths-find-emacs-roots #'paths-emacs-data-root-p)) | |
383 | |
384 (if (null emacs-roots) | |
385 (save-excursion | |
386 (set-buffer (get-buffer-create " *warning-tmp*")) | |
387 (erase-buffer) | |
388 (buffer-disable-undo (current-buffer)) | |
389 | |
390 (insert "Couldn't find an obvious default for the root of the\n" | |
391 "XEmacs hierarchy.") | |
392 | |
393 (princ "\nWARNING:\n" 'external-debugging-output) | |
394 (princ (buffer-string) 'external-debugging-output))) | |
395 | |
396 (if (eq inhibit-packages t) | |
397 (setq inhibit-packages '(early late last))) | |
398 (if (not (listp inhibit-packages)) | |
399 (setq inhibit-packages (list inhibit-packages))) | |
400 | |
401 (when debug-paths | |
402 (princ (format | |
403 "startup-setup-paths arguments: | |
404 inhibit-packages: %S | |
405 inhibit-site-lisp: %S | |
406 called-early: %S | |
407 " inhibit-packages inhibit-site-lisp called-early) | |
408 'external-debugging-output) | |
409 (princ (format | |
410 "emacs-roots: | |
411 %S | |
412 emacs-data-roots: | |
413 %S | |
414 user-init-directory: %S | |
415 configure-package-path: %S | |
416 " emacs-roots emacs-data-roots user-init-directory configure-package-path) | |
417 'external-debugging-output) | |
418 ) | |
419 | |
420 (setq lisp-directory (paths-find-lisp-directory emacs-roots)) | |
421 | |
422 (if debug-paths | |
423 (princ (format "lisp-directory:\n%S\n" lisp-directory) | |
424 'external-debugging-output)) | |
425 | |
426 (if (featurep 'mule) | |
427 (progn | |
428 (setq mule-lisp-directory | |
429 (paths-find-mule-lisp-directory emacs-roots | |
430 lisp-directory)) | |
431 (if debug-paths | |
432 (princ (format "mule-lisp-directory:\n%S\n" | |
433 mule-lisp-directory) | |
434 'external-debugging-output))) | |
435 (setq mule-lisp-directory '())) | |
436 | |
437 (setq site-directory (and (null inhibit-site-lisp) | |
438 (paths-find-site-lisp-directory emacs-roots))) | |
439 | |
440 (if (and debug-paths (null inhibit-site-lisp)) | |
441 (princ (format "site-directory:\n%S\n" site-directory) | |
442 'external-debugging-output)) | |
443 | |
444 (setq load-path (startup-find-load-path inhibit-packages t)) | |
445 | |
446 (when debug-paths | |
447 (princ (format "early-packages and early-package-load-path:\n%S\n%S\n" | |
448 early-packages early-package-load-path) | |
449 'external-debugging-output) | |
450 (princ (format "late-packages and late-package-load-path:\n%S\n%S\n" | |
451 late-packages late-package-load-path) | |
452 'external-debugging-output) | |
453 (princ (format "last-packages and last-package-load-path:\n%S\n%S\n" | |
454 last-packages last-package-load-path) | |
455 'external-debugging-output)) | |
456 | |
457 (if debug-paths | |
458 (princ (format "load-path:\n%S\n" load-path) | |
459 'external-debugging-output)) | |
460 (setq module-directory (paths-find-module-directory emacs-roots)) | |
461 (if debug-paths | |
462 (princ (format "module-directory:\n%S\n" module-directory) | |
463 'external-debugging-output)) | |
464 (setq site-module-directory (and (null inhibit-site-modules) | |
465 (paths-find-site-module-directory | |
466 emacs-roots))) | |
467 (if (and debug-paths (null inhibit-site-modules)) | |
468 (princ (format "site-module-directory:\n%S\n" | |
469 site-module-directory) | |
470 'external-debugging-output)) | |
471 | |
472 (setq module-load-path (paths-construct-module-load-path | |
473 emacs-roots | |
474 module-directory | |
475 site-module-directory)) | |
476 | |
477 (unless called-early | |
478 (setq Info-directory-list | |
479 (paths-construct-info-path | |
480 emacs-roots early-packages late-packages last-packages)) | |
481 | |
482 (if debug-paths | |
483 (princ (format "Info-directory-list:\n%S\n" Info-directory-list) | |
484 'external-debugging-output)) | |
485 | |
486 (setq exec-directory (paths-find-exec-directory emacs-roots)) | |
487 | |
488 (if debug-paths | |
489 (princ (format "exec-directory:\n%s\n" exec-directory) | |
490 'external-debugging-output)) | |
491 | |
492 (setq exec-path | |
493 (paths-construct-exec-path emacs-roots exec-directory | |
494 early-packages late-packages | |
495 last-packages)) | |
496 | |
497 (if debug-paths | |
498 (princ (format "exec-path:\n%S\n" exec-path) | |
499 'external-debugging-output)) | |
500 | |
501 (setq doc-directory (paths-find-doc-directory emacs-roots)) | |
502 | |
503 (if debug-paths | |
504 (princ (format "doc-directory:\n%S\n" doc-directory) | |
505 'external-debugging-output)) | |
506 | |
507 (setq data-directory (paths-find-data-directory emacs-roots)) | |
508 | |
509 (if debug-paths | |
510 (princ (format "data-directory:\n%S\n" data-directory) | |
511 'external-debugging-output)) | |
512 | |
513 (setq data-directory-list (paths-construct-data-directory-list | |
514 data-directory early-packages | |
515 late-packages last-packages)) | |
516 (if debug-paths | |
517 (princ (format "data-directory-list:\n%S\n" data-directory-list) | |
518 'external-debugging-output)))) | |
519 | |
520 (defun startup-find-load-path-for-packages (packages) | |
521 "Return a suitable load-path for PACKAGES. | |
522 PACKAGES is a list of package names (strings). This looks for package | |
523 directories in the load path whose last component is one of the members of | |
524 PACKAGES." | |
525 (mapcan | |
526 #'(lambda (package) | |
527 (and (member (file-name-nondirectory (directory-file-name package)) | |
528 packages) | |
529 (list package))) | |
530 (startup-find-load-path))) | |
531 | |
532 ; (defun startup-set-basic-packages-load-path () | |
533 ; "#### This is a hack. When recompiling .el files, we use -no-packages | |
534 ; to avoid problems with packages shadowing standard Lisp files | |
535 ; (e.g. unicode.el), but we really still need the stuff in xemacs-base and | |
536 ; xemacs-devel, which SHOULD NOT be in the packages." | |
537 ; (setq load-path (startup-find-load-path-for-packages | |
538 ; '("xemacs-base" "xemacs-devel")))) | |
539 | |
540 | |
541 ;;; Now actually set the paths up, for bootstrapping purposes. This is run | |
542 ;;; at early dump time and in certain cases where we use a minimal temacs | |
543 ;;; to do useful things, like rebuild DOC. | |
544 | |
545 (startup-setup-paths (if inhibit-all-packages t '(early last)) t) | |
546 | 330 |
547 ;;; setup-paths.el ends here | 331 ;;; setup-paths.el ends here |