annotate lisp/setup-paths.el @ 1737:68ed93de81b7

[xemacs-hg @ 2003-10-10 11:50:56 by stephent] E Benson bytecomp patch <87oewpmi1m.fsf_-_@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Fri, 10 Oct 2003 11:51:05 +0000
parents 8b284a83dd90
children f4e405a9d18d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 ;;; setup-paths.el --- setup various XEmacs paths
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 ;; Copyright (C) 1985-1986, 1990, 1992-1997 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 ;; Copyright (c) 1993, 1994 Sun Microsystems, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 ;; Copyright (C) 1995 Board of Trustees, University of Illinois
1330
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
6 ;; Copyright (C) 2003 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 ;; Author: Mike Sperber <sperber@informatik.uni-tuebingen.de>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 ;; Maintainer: XEmacs Development Team
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 ;; Keywords: internal, dumped
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 ;; XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 ;; under the terms of the GNU General Public License as published by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 ;; the Free Software Foundation; either version 2, or (at your option)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 ;; any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 ;; XEmacs is distributed in the hope that it will be useful, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 ;; General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 ;; You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 ;; along with XEmacs; see the file COPYING. If not, write to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 ;; Free Software Foundation, 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 ;; Boston, MA 02111-1307, USA.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 ;;; Synched up with: Not in FSF.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 ;;; Commentary:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 ;; This file is dumped with XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 460
diff changeset
35 ;; This file contains functions and variables that describe and construct
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 460
diff changeset
36 ;; the various paths into the XEmacs hierarchy from a global viewpoint.
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 460
diff changeset
37 ;; This file doesn't actually do anything.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 ;; It requires find-paths.el and packages.el.
1330
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
40
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
41 ;;; Code:
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
42
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
43 ;(setq debug-paths t)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
44
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45
1330
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
46 ;;; Path-related variables.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
47 ;;; NOTE: Many of them (`lisp-directory', `data-directory', etc.) are
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
48 ;;; built-in.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
49
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
50 (defvar emacs-roots nil
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
51 "List of plausible roots of the XEmacs hierarchy.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
52 This is a list of plausible directories in which to search for the important
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
53 directories used by XEmacs at run-time, for example `exec-directory',
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
54 `data-directory' and `lisp-directory'.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
55
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
56 Normally set at startup by calling `paths-find-emacs-roots'.")
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
57
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
58 (defvar emacs-data-roots nil
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
59 "List of plausible data roots of the XEmacs hierarchy.")
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
60
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
61 (defvar user-init-directory-base ".xemacs"
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
62 "Base of directory where user-installed init files may go.")
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
63
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
64 (defvar user-init-directory
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
65 (file-name-as-directory
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
66 (paths-construct-path (list "~" user-init-directory-base)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
67 "Directory where user-installed init files may go.")
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
68
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
69 (defvar user-init-file-base "init.el"
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
70 "Default name of the user init file if uncompiled.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
71 This should be used for migration purposes only.")
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
72
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
73 (defvar user-init-file-base-list '("init.el")
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
74 "List of allowed init files in the user's init directory.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
75 The first one found takes precedence. .elc files do not need to be listed.")
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
76
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
77 (defvar user-home-init-file-base-list
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
78 (append '(".emacs.el" ".emacs")
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
79 (and (eq system-type 'windows-nt)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
80 '("_emacs.el" "_emacs")))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
81 "List of allowed init files in the user's home directory.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
82 The first one found takes precedence. .elc files do not need to be listed.")
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
83
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
84 (defvar load-home-init-file nil
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
85 "Non-nil if XEmacs should load the init file from the home directory.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
86 Otherwise, XEmacs will offer migration to the init directory.")
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
87
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
88 (defvar load-user-init-file-p t
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
89 "Non-nil if XEmacs should load the user's init file.")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90
460
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
91 (defvar paths-core-load-path-depth 0
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 "Depth of load-path searches in core Lisp paths.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93
452
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 442
diff changeset
94 (defvar paths-site-load-path-depth 1
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 442
diff changeset
95 "Depth of load-path searches in site Lisp paths.")
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 442
diff changeset
96
460
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
97 (defvar paths-mule-load-path-depth 0
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
98 "Depth of load-path searches in Mule Lisp paths.")
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
99
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 (defvar paths-default-info-directories
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 (mapcar (function
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 (lambda (dirlist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 (paths-construct-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 dirlist (char-to-string directory-sep-char))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 '(("usr" "local" "info")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 ("usr" "info")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 ("usr" "local" "share" "info")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 ("usr" "share" "info")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 "Directories appended to the end of the info path by default.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110
1330
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
111
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
112 ;;; Basic utility functions.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
113
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
114 (defun paths-emacs-root-p (directory)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
115 "Check if DIRECTORY is a plausible installation root."
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
116 (or
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
117 ;; installed
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
118 (paths-file-readable-directory-p (paths-construct-path (list directory
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
119 "lib"
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
120 (construct-emacs-version-name))))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
121 ;; in-place or windows-nt. windows-nt equivalent of --srcdir is
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
122 ;; BUILD_DIR in config.inc, and has no lisp/ or etc/ since symlinks
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
123 ;; don't exist. instead, xemacs.mak points configure-lisp-directory and
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
124 ;; configure-data-directory at the right places.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
125 (and
1526
8b284a83dd90 [xemacs-hg @ 2003-06-13 00:11:16 by adrian]
adrian
parents: 1330
diff changeset
126 (or configure-exec-directory (paths-file-readable-directory-p (paths-construct-path (list directory "lib-src"))) (eq system-type 'windows-nt))
1330
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
127 (or configure-lisp-directory (paths-file-readable-directory-p (paths-construct-path (list directory "lisp"))))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
128 (or configure-data-directory (paths-file-readable-directory-p (paths-construct-path (list directory "etc")))))))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
129
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
130 (defun paths-emacs-data-root-p (directory)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
131 "Check if DIRECTORY is a plausible data installation root.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
132 A data installation root is one containing data files that may be shared
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
133 among multiple different versions of XEmacs, the packages in particular."
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
134 (or
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
135 ;; installed
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
136 (paths-file-readable-directory-p (paths-construct-path (list directory
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
137 "lib"
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
138 emacs-program-name)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
139 (paths-file-readable-directory-p (paths-construct-path (list directory
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
140 "lib"
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
141 (construct-emacs-version-name))))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
142 ;; in-place or windows-nt
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
143 (and
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
144 (paths-file-readable-directory-p (paths-construct-path (list directory "lisp")))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
145 (paths-file-readable-directory-p (paths-construct-path (list directory "etc"))))))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
146
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
147 (defun paths-find-emacs-root (invocation-directory invocation-name)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
148 "Find the run-time root of XEmacs."
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
149 (let* ((executable-file-name (paths-chase-symlink
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
150 (concat invocation-directory
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
151 invocation-name)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
152 (executable-directory (file-name-directory executable-file-name))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
153 (maybe-root-1 (file-name-as-directory
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
154 (paths-construct-path '("..") executable-directory)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
155 (maybe-root-2 (file-name-as-directory
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
156 (paths-construct-path '(".." "..") executable-directory))))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
157 (or (and (paths-emacs-root-p maybe-root-1)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
158 maybe-root-1)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
159 (and (paths-emacs-root-p maybe-root-2)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
160 maybe-root-2))))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
161
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
162 (defun paths-find-emacs-roots (root-p)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
163 "Find all plausible installation roots for XEmacs.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
164 This is a list of plausible directories in which to search for the important
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
165 directories used by XEmacs at run-time, for example `exec-directory',
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
166 `data-directory' and `lisp-directory'.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
167 ROOT-P is a function that tests whether a root is plausible."
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
168 (let* ((potential-invocation-root
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
169 (paths-find-emacs-root invocation-directory invocation-name))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
170 (invocation-roots
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
171 (and potential-invocation-root
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
172 (list potential-invocation-root)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
173 (potential-installation-roots
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
174 (paths-uniq-append
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
175 (and configure-exec-prefix-directory
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
176 (list (file-name-as-directory
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
177 configure-exec-prefix-directory)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
178 (and configure-prefix-directory
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
179 (list (file-name-as-directory
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
180 configure-prefix-directory)))))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
181 (installation-roots
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
182 (paths-filter root-p potential-installation-roots)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
183 (paths-uniq-append invocation-roots
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
184 installation-roots)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
185
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 (defun paths-find-site-lisp-directory (roots)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 "Find the site Lisp directory of the XEmacs hierarchy."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 (paths-find-site-directory roots "site-lisp"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 configure-site-directory))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 (defun paths-find-site-module-directory (roots)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 "Find the site modules directory of the XEmacs hierarchy."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 (paths-find-site-directory roots "site-modules"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 configure-site-module-directory))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 (defun paths-find-lisp-directory (roots)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 "Find the main Lisp directory of the XEmacs hierarchy."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 (paths-find-version-directory roots "lisp"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 configure-lisp-directory))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203
460
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
204 (defun paths-find-mule-lisp-directory (roots &optional lisp-directory)
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
205 "Find the Mule Lisp directory of the XEmacs hierarchy."
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
206 ;; #### kludge
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
207 (if lisp-directory
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
208 (let ((guess
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
209 (file-name-as-directory
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
210 (paths-construct-path (list lisp-directory "mule")))))
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
211 (if (paths-file-readable-directory-p guess)
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
212 guess
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
213 (paths-find-version-directory roots "mule-lisp"
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
214 nil
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
215 configure-mule-lisp-directory)))))
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
216
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 (defun paths-find-module-directory (roots)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 "Find the main modules directory of the XEmacs hierarchy."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 (paths-find-architecture-directory roots "modules"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 nil configure-module-directory))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 (defun paths-construct-load-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 (roots early-package-load-path late-package-load-path last-package-load-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 lisp-directory
460
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
225 &optional site-lisp-directory mule-lisp-directory)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 "Construct the load path."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 (let* ((envvar-value (getenv "EMACSLOADPATH"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 (env-load-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 (and envvar-value
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 (paths-decode-directory-path envvar-value 'drop-empties)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 (site-lisp-load-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 (and site-lisp-directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 (paths-find-recursive-load-path (list site-lisp-directory)
452
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 442
diff changeset
234 paths-site-load-path-depth)))
460
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
235 (mule-lisp-load-path
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
236 (and mule-lisp-directory
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
237 (paths-find-recursive-load-path (list mule-lisp-directory)
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
238 paths-mule-load-path-depth)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 (lisp-load-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 (and lisp-directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 (paths-find-recursive-load-path (list lisp-directory)
452
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 442
diff changeset
242 paths-core-load-path-depth))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 (append env-load-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 early-package-load-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 site-lisp-load-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 late-package-load-path
460
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 452
diff changeset
247 mule-lisp-load-path
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 lisp-load-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 last-package-load-path)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 (defun paths-construct-module-load-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 (root module-directory &optional site-module-directory)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 "Construct the modules load path."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 (let* ((envvar-value (getenv "EMACSMODULEPATH"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 (env-module-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 (and envvar-value
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 (paths-decode-directory-path envvar-value 'drop-empties)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 (site-module-load-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 (and site-module-directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 (paths-find-recursive-load-path (list site-module-directory)
452
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 442
diff changeset
261 paths-site-load-path-depth)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 (module-load-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 (and module-directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 (paths-find-recursive-load-path (list module-directory)
452
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 442
diff changeset
265 paths-core-load-path-depth))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 (append env-module-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 site-module-load-path
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 module-load-path)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 (defun paths-construct-info-path (roots early-packages late-packages last-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 "Construct the info path."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 (let ((info-path-envval (getenv "INFOPATH")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 (paths-uniq-append
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 (append
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 (let ((info-directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 (paths-find-version-directory roots "info"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 configure-info-directory)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 (and info-directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 (list info-directory)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 (packages-find-package-info-path early-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 (packages-find-package-info-path late-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 (packages-find-package-info-path last-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 (and info-path-envval
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 (paths-decode-directory-path info-path-envval 'drop-empties)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 (and (null info-path-envval)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 (paths-uniq-append
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 (paths-directories-which-exist configure-info-path)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 (paths-directories-which-exist paths-default-info-directories))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 (defun paths-find-doc-directory (roots)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 "Find the documentation directory."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 (paths-find-architecture-directory roots "lib-src" nil configure-doc-directory))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 (defun paths-find-exec-directory (roots)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 "Find the binary directory."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 (paths-find-architecture-directory roots "lib-src"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 nil configure-exec-directory))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 (defun paths-construct-exec-path (roots exec-directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 early-packages late-packages last-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 "Find the binary path."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 (append
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 (let ((path-envval (getenv "PATH")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 (if path-envval
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 (paths-decode-directory-path path-envval 'drop-empties)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 (packages-find-package-exec-path early-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 (packages-find-package-exec-path late-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 (let ((emacspath-envval (getenv "EMACSPATH")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 (and emacspath-envval
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 (split-path emacspath-envval)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 (and exec-directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 (list exec-directory))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 (packages-find-package-exec-path last-packages)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 (defun paths-find-data-directory (roots)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 "Find the data directory."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 (paths-find-version-directory roots "etc" "EMACSDATA" configure-data-directory))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 (defun paths-construct-data-directory-list (data-directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 early-packages late-packages last-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 "Find the data path."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 (append
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 (packages-find-package-data-path early-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 (packages-find-package-data-path late-packages)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 (list data-directory)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 (packages-find-package-data-path last-packages)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328
1330
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
329
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
330 ;;; High-level functions to set up the paths.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
331
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
332 (defun startup-find-load-path (&optional inhibit-packages
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
333 set-global-package-paths)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
334 "Determine the value for `load-path'.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
335 INHIBIT-PACKAGES says which types of packages, if any, to omit from the
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
336 returned value. It can be `t' (omit all), one of the symbols `early',
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
337 `late', or `last', or a list of one or more of the symbols.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
338
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
339 If SET-GLOBAL-PACKAGE-PATHS is non-nil, initialize the global package path
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
340 variables referring to the particular types of packages (`early-packages',
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
341 `early-package-load-path', `late-packages', `late-package-load-path',
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
342 `last-packages', `last-package-load-path')."
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
343 (let (earlyp latep lastp earlyp-lp latep-lp lastp-lp)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
344 (apply #'(lambda (early late last)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
345 (setq earlyp (and (not (memq 'early inhibit-packages)) early))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
346 (setq latep (and (not (memq 'late inhibit-packages)) late))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
347 (setq lastp (and (not (memq 'last inhibit-packages)) last)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
348 (packages-find-packages
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
349 emacs-data-roots
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
350 (packages-compute-package-locations user-init-directory)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
351
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
352 (setq earlyp-lp (packages-find-package-load-path earlyp))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
353 (setq latep-lp (packages-find-package-load-path latep))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
354 (setq lastp-lp (packages-find-package-load-path lastp))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
355
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
356 (when set-global-package-paths
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
357 (setq early-packages earlyp
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
358 late-packages latep
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
359 last-packages lastp
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
360 early-package-load-path earlyp-lp
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
361 late-package-load-path latep-lp
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
362 last-package-load-path lastp-lp))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
363
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
364 (paths-construct-load-path emacs-roots earlyp-lp latep-lp lastp-lp
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
365 lisp-directory site-directory
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
366 mule-lisp-directory)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
367
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
368 (defun startup-setup-paths (&optional inhibit-packages called-early)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
369 "Setup all the various paths.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
370 INHIBIT-PACKAGES says which types of packages, if any, to omit from the
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
371 returned value. It can be `t' (omit all), one of the symbols `early',
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
372 `late', or `last', or a list of one or more of the symbols.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
373
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
374 This function is idempotent, so call this as often as you like!"
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
375
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
376 (setq debug-paths (or debug-paths
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
377 (and (getenv "EMACSDEBUGPATHS")
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
378 t)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
379
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
380 (setq emacs-roots (paths-find-emacs-roots #'paths-emacs-data-root-p))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
381
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
382 (setq emacs-data-roots (paths-find-emacs-roots #'paths-emacs-data-root-p))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
383
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
384 (if (null emacs-roots)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
385 (save-excursion
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
386 (set-buffer (get-buffer-create " *warning-tmp*"))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
387 (erase-buffer)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
388 (buffer-disable-undo (current-buffer))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
389
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
390 (insert "Couldn't find an obvious default for the root of the\n"
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
391 "XEmacs hierarchy.")
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
392
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
393 (princ "\nWARNING:\n" 'external-debugging-output)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
394 (princ (buffer-string) 'external-debugging-output)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
395
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
396 (if (eq inhibit-packages t)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
397 (setq inhibit-packages '(early late last)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
398 (if (not (listp inhibit-packages))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
399 (setq inhibit-packages (list inhibit-packages)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
400
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
401 (when debug-paths
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
402 (princ (format
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
403 "startup-setup-paths arguments:
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
404 inhibit-packages: %S
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
405 inhibit-site-lisp: %S
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
406 called-early: %S
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
407 " inhibit-packages inhibit-site-lisp called-early)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
408 'external-debugging-output)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
409 (princ (format
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
410 "emacs-roots:
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
411 %S
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
412 emacs-data-roots:
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
413 %S
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
414 user-init-directory: %S
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
415 configure-package-path: %S
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
416 " emacs-roots emacs-data-roots user-init-directory configure-package-path)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
417 'external-debugging-output)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
418 )
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
419
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
420 (setq lisp-directory (paths-find-lisp-directory emacs-roots))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
421
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
422 (if debug-paths
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
423 (princ (format "lisp-directory:\n%S\n" lisp-directory)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
424 'external-debugging-output))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
425
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
426 (if (featurep 'mule)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
427 (progn
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
428 (setq mule-lisp-directory
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
429 (paths-find-mule-lisp-directory emacs-roots
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
430 lisp-directory))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
431 (if debug-paths
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
432 (princ (format "mule-lisp-directory:\n%S\n"
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
433 mule-lisp-directory)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
434 'external-debugging-output)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
435 (setq mule-lisp-directory '()))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
436
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
437 (setq site-directory (and (null inhibit-site-lisp)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
438 (paths-find-site-lisp-directory emacs-roots)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
439
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
440 (if (and debug-paths (null inhibit-site-lisp))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
441 (princ (format "site-directory:\n%S\n" site-directory)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
442 'external-debugging-output))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
443
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
444 (setq load-path (startup-find-load-path inhibit-packages t))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
445
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
446 (when debug-paths
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
447 (princ (format "early-packages and early-package-load-path:\n%S\n%S\n"
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
448 early-packages early-package-load-path)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
449 'external-debugging-output)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
450 (princ (format "late-packages and late-package-load-path:\n%S\n%S\n"
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
451 late-packages late-package-load-path)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
452 'external-debugging-output)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
453 (princ (format "last-packages and last-package-load-path:\n%S\n%S\n"
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
454 last-packages last-package-load-path)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
455 'external-debugging-output))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
456
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
457 (if debug-paths
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
458 (princ (format "load-path:\n%S\n" load-path)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
459 'external-debugging-output))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
460 (setq module-directory (paths-find-module-directory emacs-roots))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
461 (if debug-paths
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
462 (princ (format "module-directory:\n%S\n" module-directory)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
463 'external-debugging-output))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
464 (setq site-module-directory (and (null inhibit-site-modules)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
465 (paths-find-site-module-directory
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
466 emacs-roots)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
467 (if (and debug-paths (null inhibit-site-modules))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
468 (princ (format "site-module-directory:\n%S\n"
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
469 site-module-directory)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
470 'external-debugging-output))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
471
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
472 (setq module-load-path (paths-construct-module-load-path
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
473 emacs-roots
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
474 module-directory
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
475 site-module-directory))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
476
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
477 (unless called-early
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
478 (setq Info-directory-list
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
479 (paths-construct-info-path
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
480 emacs-roots early-packages late-packages last-packages))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
481
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
482 (if debug-paths
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
483 (princ (format "Info-directory-list:\n%S\n" Info-directory-list)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
484 'external-debugging-output))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
485
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
486 (setq exec-directory (paths-find-exec-directory emacs-roots))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
487
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
488 (if debug-paths
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
489 (princ (format "exec-directory:\n%s\n" exec-directory)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
490 'external-debugging-output))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
491
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
492 (setq exec-path
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
493 (paths-construct-exec-path emacs-roots exec-directory
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
494 early-packages late-packages
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
495 last-packages))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
496
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
497 (if debug-paths
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
498 (princ (format "exec-path:\n%S\n" exec-path)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
499 'external-debugging-output))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
500
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
501 (setq doc-directory (paths-find-doc-directory emacs-roots))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
502
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
503 (if debug-paths
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
504 (princ (format "doc-directory:\n%S\n" doc-directory)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
505 'external-debugging-output))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
506
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
507 (setq data-directory (paths-find-data-directory emacs-roots))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
508
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
509 (if debug-paths
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
510 (princ (format "data-directory:\n%S\n" data-directory)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
511 'external-debugging-output))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
512
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
513 (setq data-directory-list (paths-construct-data-directory-list
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
514 data-directory early-packages
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
515 late-packages last-packages))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
516 (if debug-paths
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
517 (princ (format "data-directory-list:\n%S\n" data-directory-list)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
518 'external-debugging-output))))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
519
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
520 (defun startup-find-load-path-for-packages (packages)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
521 "Return a suitable load-path for PACKAGES.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
522 PACKAGES is a list of package names (strings). This looks for package
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
523 directories in the load path whose last component is one of the members of
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
524 PACKAGES."
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
525 (mapcan
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
526 #'(lambda (package)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
527 (and (member (file-name-nondirectory (directory-file-name package))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
528 packages)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
529 (list package)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
530 (startup-find-load-path)))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
531
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
532 ; (defun startup-set-basic-packages-load-path ()
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
533 ; "#### This is a hack. When recompiling .el files, we use -no-packages
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
534 ; to avoid problems with packages shadowing standard Lisp files
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
535 ; (e.g. unicode.el), but we really still need the stuff in xemacs-base and
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
536 ; xemacs-devel, which SHOULD NOT be in the packages."
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
537 ; (setq load-path (startup-find-load-path-for-packages
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
538 ; '("xemacs-base" "xemacs-devel"))))
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
539
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
540
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
541 ;;; Now actually set the paths up, for bootstrapping purposes. This is run
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
542 ;;; at early dump time and in certain cases where we use a minimal temacs
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
543 ;;; to do useful things, like rebuild DOC.
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
544
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
545 (startup-setup-paths (if inhibit-all-packages t '(early last)) t)
4542b72c005e [xemacs-hg @ 2003-03-01 07:25:26 by ben]
ben
parents: 776
diff changeset
546
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 ;;; setup-paths.el ends here