annotate lisp/prim/startup.el @ 110:fe104dbd9147 r20-1b7

Import from CVS: tag r20-1b7
author cvs
date Mon, 13 Aug 2007 09:19:45 +0200
parents 360340f9fd5f
children 8619ce7e4c50
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; startup.el --- process XEmacs shell arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; Copyright (C) 1985-1986, 1990, 1992-1995 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Copyright (c) 1993, 1994 Sun Microsystems, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Copyright (C) 1995 Board of Trustees, University of Illinois
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; Maintainer: XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; Keywords: internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 10
diff changeset
23 ;; along with XEmacs; see the file COPYING. If not, write to the
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
24 ;; Free Software Foundation, 59 Temple Place - Suite 330,
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 10
diff changeset
25 ;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
27 ;;; Synched up with: FSF 19.34.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;; -batch, -t, and -nw are processed by main() in emacs.c and are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;;; never seen by lisp code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;;; -version and -help are special-cased as well: they imply -batch,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;;; but are left on the list for lisp code to process.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (setq top-level '(normal-top-level))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 (defvar command-line-processed nil "t once command line has been processed")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
76
c0c698873ce1 Import from CVS: tag r20-0b33
cvs
parents: 72
diff changeset
42 (defconst startup-message-timeout 1200) ; More or less disable the timeout
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (defconst inhibit-startup-message nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 "*Non-nil inhibits the initial startup message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 This is for use in your personal init file, once you are familiar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 with the contents of the startup message.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;; #### FSFmacs randomness
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
50 ;;(defconst inhibit-startup-echo-area-message nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
51 ;; "*Non-nil inhibits the initial startup echo area message.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
52 ;;Inhibition takes effect only if your `.emacs' file contains
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
53 ;;a line of this form:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
54 ;; (setq inhibit-startup-echo-area-message \"YOUR-USER-NAME\")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
55 ;;If your `.emacs' file is byte-compiled, use the following form instead:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
56 ;; (eval '(setq inhibit-startup-echo-area-message \"YOUR-USER-NAME\"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
57 ;;Thus, someone else using a copy of your `.emacs' file will see
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
58 ;;the startup message unless he personally acts to inhibit it.")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (defconst inhibit-default-init nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 "*Non-nil inhibits loading the `default' library.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (defvar command-line-args-left nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 "List of command-line args not yet processed.") ; bound by `command-line'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (defvar command-line-default-directory nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 "Default directory to use for command line arguments.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 This is normally copied from `default-directory' when XEmacs starts.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (defvar before-init-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 "Functions to call after handling urgent options but before init files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 The frame system uses this to open frames to display messages while
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 XEmacs loads the user's initialization file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (defvar after-init-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 "Functions to call after loading the init file (`~/.emacs').
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 The call is not protected by a condition-case, so you can set `debug-on-error'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 in `.emacs', and put all the actual code on `after-init-hook'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (defvar term-setup-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 "Functions to be called after loading terminal-specific Lisp code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 See `run-hooks'. This variable exists for users to set,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 so as to override the definitions made by the terminal-specific file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 XEmacs never sets this variable itself.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (defvar keyboard-type nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 "The brand of keyboard you are using.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 This variable is used to define
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 the proper function and keypad keys for use under X. It is used in a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 fashion analogous to the environment value TERM.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (defvar window-setup-hook nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 "Normal hook run to initialize window system display.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 XEmacs runs this hook after processing the command line arguments and loading
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 the user's init file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (defconst initial-major-mode 'lisp-interaction-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 "Major mode command symbol to use for the initial *scratch* buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (defvar init-file-user nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 "Identity of user whose `.emacs' file is or was read.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 The value is nil if no init file is being used; otherwise, it may be either
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 the null string, meaning that the init file was taken from the user that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 originally logged in, or it may be a string containing a user's name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 In either of the latter cases, `(concat \"~\" init-file-user \"/\")'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 evaluates to the name of the directory where the `.emacs' file was
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 looked for.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 Setting `init-file-user' does not prevent Emacs from loading
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 `site-start.el'. The only way to do that is to use `--no-site-file'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ;; #### called `site-run-file' in FSFmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (defvar site-start-file (purecopy "site-start")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 "File containing site-wide run-time initializations.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 This file is loaded at run-time before `~/.emacs'. It contains inits
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 that need to be in place for the entire site, but which, due to their
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 higher incidence of change, don't make sense to load into XEmacs'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 dumped image. Thus, the run-time load order is: 1. file described in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 this variable, if non-nil; 2. `~/.emacs'; 3. `default.el'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 Don't use the `site-start.el' file for things some users may not like.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 Put them in `default.el' instead, so that users can more easily
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 override them. Users can prevent loading `default.el' with the `-q'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 option or by setting `inhibit-default-init' in their own init files,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 but inhibiting `site-start.el' requires `--no-site-file', which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 is less convenient.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
130 ;;(defconst iso-8859-1-locale-regexp "8859[-_]?1"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
131 ;; "Regexp that specifies when to enable the ISO 8859-1 character set.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
132 ;;We do that if this regexp matches the locale name
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
133 ;;specified by the LC_ALL, LC_CTYPE and LANG environment variables.")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (defvar mail-host-address nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 "*Name of this machine, for purposes of naming users.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (defvar user-mail-address nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 "*Full mailing address of this user.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 This is initialized based on `mail-host-address',
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 after your init file is read, in case it sets `mail-host-address'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (defvar auto-save-list-file-prefix "~/.saves-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 "Prefix for generating auto-save-list-file-name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 Emacs's pid and the system name will be appended to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 this prefix to create a unique file name.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (defvar init-file-debug nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (defvar init-file-had-error nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (defvar init-file-loaded nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 "True after the user's init file has been loaded (or suppressed with -q).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 This will be true when `after-init-hook' is run and at all times
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 after, and will not be true at any time before.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (defvar initial-frame-unmapped-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
160
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
161 (defvar command-switch-alist
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
162 (purecopy
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
163 '(("-help" . command-line-do-help)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
164 ("-flags" . command-line-do-help)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
165 ("-h" . command-line-do-help)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
166 ("-?" . command-line-do-help)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
167 ("-version". command-line-do-version)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
168 ("-V" . command-line-do-version)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
169 ("-funcall". command-line-do-funcall)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
170 ("-f" . command-line-do-funcall)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
171 ("-e" . command-line-do-funcall-1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
172 ("-eval" . command-line-do-eval)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
173 ("-load" . command-line-do-load)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
174 ("-l" . command-line-do-load)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
175 ("-insert" . command-line-do-insert)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
176 ("-i" . command-line-do-insert)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
177 ("-kill" . command-line-do-kill)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
178 ;; Options like +35 are handled specially.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
179 ;; Window-system, site, or package-specific code might add to this.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
180 ;; X11 handles its options by letting Xt remove args from this list.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
181 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
182 "Alist of command-line switches.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
183 Elements look like (SWITCH-STRING . HANDLER-FUNCTION).
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
184 HANDLER-FUNCTION receives switch name as sole arg;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
185 remaining command-line args are in the variable `command-line-args-left'.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
186
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 ;;; default switches
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 ;;; Note: these doc strings are semi-magical.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
190 (defun command-line-do-help (arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
191 "Print the XEmacs usage message and exit."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
192 (let ((standard-output 'external-debugging-output))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
193 (princ (concat "\n" (emacs-version) "\n\n"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
194 (princ
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
195 (if (featurep 'x)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
196 (concat "XEmacs accepts all standard X Toolkit command line options.\n"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
197 "In addition, the")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
198 "The"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
199 (princ " following options are accepted:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
200
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
201 -t <device> Use TTY <device> instead of the terminal for input
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
202 and output. This implies the -nw option.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
203 -nw Inhibit the use of any window-system-specific
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
204 display code: use the current tty.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
205 -batch Execute noninteractively (messages go to stderr).
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
206 -debug-init Enter the debugger if an error in the init file occurs.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
207 -unmapped Do not map the initial frame.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
208 -no-site-file Do not load the site-specific init file (site-start.el).
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
209 -no-init-file Do not load the user-specific init file (~/.emacs).
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
210 -q Same as -no-init-file.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
211 -user <user> Load user's init file instead of your own.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
212 -u <user> Same as -user.\n")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
213 (let ((l command-switch-alist)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
214 (insert (lambda (&rest x)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
215 (princ " ")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
216 (let ((len 2))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
217 (while x
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
218 (princ (car x))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
219 (incf len (length (car x)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
220 (setq x (cdr x)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
221 (when (>= len 24)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
222 (terpri) (setq len 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
223 (while (< len 24)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
224 (princ " ")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
225 (incf len))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
226 (while l
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
227 (let ((name (car (car l)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
228 (fn (cdr (car l)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
229 doc arg cons)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
230 (cond
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
231 ((and (symbolp fn) (get fn 'undocumented)) nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
232 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
233 (setq doc (documentation fn))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
234 (if (member doc '(nil "")) (setq doc "(undocumented)"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
235 (cond ((string-match "\n\\(<.*>\\)\n?\\'" doc)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
236 ;; Doc of the form "The frobber switch\n<arg1> <arg2>"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
237 (setq arg (substring doc (match-beginning 1) (match-end 1))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
238 doc (substring doc 0 (match-beginning 0))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
239 ((string-match "\n+\\'" doc)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
240 (setq doc (substring doc 0 (match-beginning 0)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
241 (if (and (setq cons (rassq fn command-switch-alist))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
242 (not (eq cons (car l))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
243 (setq doc (format "Same as %s." (car cons))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
244 (if arg
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
245 (funcall insert name " " arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
246 (funcall insert name))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
247 (princ doc)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
248 (terpri))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
249 (setq l (cdr l))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
250 (princ "\
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
251 +N <file> Start displaying <file> at line N.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
252
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
253 Anything else is considered a file name, and is placed into a buffer for
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
254 editing.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
255
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
256 XEmacs has an online tutorial and manuals. Type ^Ht (Control-h t) after
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
257 starting XEmacs to run the tutorial. Type ^Hi to enter the manual browser.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
258 Type ^H^H^H (Control-h Control-h Control-h) to get more help options.\n")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
259
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
260 (kill-emacs 0)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
261
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 (defun command-line-do-funcall (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 "Invoke the named lisp function with no arguments.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 <function>"
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
265 (funcall (intern (pop command-line-args-left))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (fset 'command-line-do-funcall-1 'command-line-do-funcall)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (put 'command-line-do-funcall-1 'undocumented t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (defun command-line-do-eval (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 "Evaluate the lisp form. Quote it carefully.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 <form>"
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
272 (eval (read (pop command-line-args-left))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (defun command-line-do-load (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 "Load the named file of Lisp code into XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 <file>"
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
277 (let ((file (pop command-line-args-left)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 ;; Take file from default dir if it exists there;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 ;; otherwise let `load' search for it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (if (file-exists-p (expand-file-name file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (setq file (expand-file-name file)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
282 (load file nil t)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (defun command-line-do-insert (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 "Insert file into the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 <file>"
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
287 (insert-file-contents (pop command-line-args-left)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (defun command-line-do-kill (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 "Exit XEmacs."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (kill-emacs t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (defun command-line-do-version (arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 "Print version info and exit."
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
295 (princ (concat (emacs-version) "\n"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (kill-emacs 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 ;;; Processing the command line and loading various init files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (defun early-error-handler (&rest debugger-args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 "You should probably not be using this."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 ;; Used as the debugger during XEmacs initialization; if an error occurs,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 ;; print some diagnostics, and kill XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 ;; output the contents of the warning buffer, since it won't be seen
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 ;; otherwise.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 ;; #### kludge! The call to Feval forces the pending warnings to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 ;; get output. There definitely needs to be a better way.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (let ((buffer (eval (get-buffer-create "*Warnings*"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (princ (buffer-substring (point-min buffer) (point-max buffer) buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 'external-debugging-output))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (let ((string "Initialization error")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (error (nth 1 debugger-args))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (debug-on-error nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (stream 'external-debugging-output))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (if (null error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (princ string stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (princ (concat "\n" string ": ") stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (condition-case ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (display-error error stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (error (princ "<<< error printing error message >>>" stream)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (princ "\n" stream)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (if (memq (car-safe error) '(void-function void-variable))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (princ "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 This probably means that XEmacs is picking up an old version of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 the lisp library, or that some .elc files are not up-to-date.\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 stream)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
330 (when (not suppress-early-error-handler-backtrace)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
331 (let ((print-length 1000)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
332 (print-level 1000)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
333 (print-escape-newlines t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
334 (print-readably nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
335 (when (getenv "EMACSLOADPATH")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
336 (princ (format "\n$EMACSLOADPATH is %s" (getenv "EMACSLOADPATH"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
337 stream))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
338 (princ (format "\nexec-directory is %S" exec-directory) stream)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
339 (princ (format "\ndata-directory is %S" data-directory) stream)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
340 (princ (format "\ndoc-directory is %S" doc-directory) stream)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
341 (princ (format "\nload-path is %S" load-path) stream)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
342 (princ "\n\n" stream)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
343 (when (not suppress-early-error-handler-backtrace)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
344 (backtrace stream t)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (kill-emacs -1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (defun normal-top-level ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (if command-line-processed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (message "Back to top level.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (setq command-line-processed t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 ;; Canonicalize HOME (PWD is canonicalized by init_buffer in buffer.c)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
352 (unless (eq system-type 'vax-vms)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
353 (let ((value (getenv "HOME")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
354 (if (and value
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
355 (< (length value) (length default-directory))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
356 (equal (file-attributes default-directory)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
357 (file-attributes value)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
358 (setq default-directory (file-name-as-directory value)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (setq default-directory (abbreviate-file-name default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (initialize-xemacs-paths)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (command-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 ;; Do this again, in case .emacs defined more abbreviations.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (setq default-directory (abbreviate-file-name default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 ;; Specify the file for recording all the auto save files of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 ;; this session. This is used by recover-session.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (setq auto-save-list-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (format "%s%d-%s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 auto-save-list-file-prefix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (emacs-pid)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (system-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (run-hooks 'emacs-startup-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (and term-setup-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (run-hooks 'term-setup-hook))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (setq term-setup-hook nil)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
377 ;; ;; Modify the initial frame based on what .emacs puts into
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
378 ;; ;; ...-frame-alist.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (frame-notice-user-settings)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
380 ;; ;;####FSFmacs junk
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
381 ;; ;; Now we know the user's default font, so add it to the menu.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
382 ;; (if (fboundp 'font-menu-add-default)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
383 ;; (font-menu-add-default))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
384 (when window-setup-hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
385 (run-hooks 'window-setup-hook))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (setq window-setup-hook nil))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
387 ;;####FSFmacs junk
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
388 ;; (or menubar-bindings-done
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
389 ;; (precompute-menubar-bindings))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 ;;####FSFmacs junk
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 ;;; Precompute the keyboard equivalents in the menu bar items.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
394 ;;(defun precompute-menubar-bindings ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
395 ;; (if (eq window-system 'x)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
396 ;; (let ((submap (lookup-key global-map [menu-bar])))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
397 ;; (while submap
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
398 ;; (and (consp (car submap))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
399 ;; (symbolp (car (car submap)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
400 ;; (stringp (car-safe (cdr (car submap))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
401 ;; (keymapp (cdr (cdr (car submap))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
402 ;; (x-popup-menu nil (cdr (cdr (car submap)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
403 ;; (setq submap (cdr submap))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
405 (defun command-line-early (args)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 ;; This processes those switches which need to be processed before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 ;; starting up the window system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (setq command-line-default-directory default-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 ;; See if we should import version-control from the environment variable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (let ((vc (getenv "VERSION_CONTROL")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (cond ((eq vc nil)) ;don't do anything if not set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 ((or (string= vc "t")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (string= vc "numbered"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (setq version-control t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 ((or (string= vc "nil")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (string= vc "existing"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (setq version-control nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 ((or (string= vc "never")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (string= vc "simple"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (setq version-control 'never))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
424 ;;####FSFmacs
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
425 ;; (if (let ((ctype
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
426 ;; ;; Use the first of these three envvars that has a nonempty value.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
427 ;; (or (let ((string (getenv "LC_ALL")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
428 ;; (and (not (equal string "")) string))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
429 ;; (let ((string (getenv "LC_CTYPE")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
430 ;; (and (not (equal string "")) string))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
431 ;; (let ((string (getenv "LANG")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
432 ;; (and (not (equal string "")) string)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
433 ;; (and ctype
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
434 ;; (string-match iso-8859-1-locale-regexp ctype)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
435 ;; (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
436 ;; (standard-display-european t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
437 ;; (require 'iso-syntax)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
439 ;; Figure out which user's init file to load,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
440 ;; either from the environment or from the options.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
441 (setq init-file-user (if (noninteractive) nil (user-login-name)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
442 ;; If user has not done su, use current $HOME to find .emacs.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
443 (and init-file-user (string= init-file-user (user-real-login-name))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
444 (setq init-file-user ""))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
446 ;; Allow (at least) these arguments anywhere in the command line
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
447 (let ((new-args nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
448 (arg nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
449 (while args
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
450 (setq arg (pop args))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
451 (cond
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
452 ((or (string= arg "-q")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
453 (string= arg "-no-init-file"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
454 (setq init-file-user nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
455 ((string= arg "-no-site-file")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
456 (setq site-start-file nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
457 ((or (string= arg "-u")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
458 (string= arg "-user"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
459 (setq init-file-user (pop args)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
460 ((string= arg "-debug-init")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
461 (setq init-file-debug t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
462 ((string= arg "-unmapped")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
463 (setq initial-frame-unmapped-p t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
464 ((or (string= arg "--") (string= arg "-"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
465 (while args
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
466 (push (pop args) new-args)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
467 (t (push arg new-args))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
468
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
469 (nreverse new-args)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (defun command-line ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (let ((command-line-args-left (cdr command-line-args)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (let ((debugger 'early-error-handler)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (debug-on-error t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (set-default-load-path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 ;; Process magic command-line switches like -q and -u. Do this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 ;; before creating the first frame because some of these switches
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 ;; may affect that. I think it's ok to do this before establishing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 ;; the X connection, and maybe someday things like -nw can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 ;; handled here instead of down in C.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
483 (setq command-line-args-left (command-line-early command-line-args-left))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 ;; Setup the toolbar icon directory
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
486 (when (featurep 'toolbar)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
487 (init-toolbar-location))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
489 ;; Initialize the built-in glyphs and default specifier lists
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
490 (when (not noninteractive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
491 (init-glyphs))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 ;; Run the window system's init function. tty is considered to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 ;; a type of window system for this purpose. This creates the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 ;; initial (non stdio) device.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
496 (when (and initial-window-system (not noninteractive))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
497 (funcall (intern (concat "init-"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
498 (symbol-name initial-window-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
499 "-win"))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 ;; When not in batch mode, this creates the first visible frame,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 ;; and deletes the stdio device.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (frame-initialize))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 ;; We have normality, I repeat, we have normality. Anything you still
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 ;; can't cope with is therefore your own problem. (And we don't need
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 ;; to kill XEmacs for it.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 ;;; Load init files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (load-init-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 ;; If *scratch* exists and init file didn't change its mode, initialize it.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
515 (when (get-buffer "*scratch*")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
516 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
517 (set-buffer "*scratch*")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
518 (when (eq major-mode 'fundamental-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
519 (funcall initial-major-mode))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 ;; Load library for our terminal type.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 ;; User init file can set term-file-prefix to nil to prevent this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 ;; Note that for any TTY's opened subsequently, the TTY init
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 ;; code will run this.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
525 (when (and (eq 'tty (console-type))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
526 (not (noninteractive)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
527 (load-terminal-library))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 ;; Process the remaining args.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (command-line-1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 ;; it was turned on by default so that the warnings don't get displayed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 ;; until after the splash screen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 (setq inhibit-warning-display nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 ;; If -batch, terminate after processing the command options.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
536 (when (noninteractive) (kill-emacs t))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 (defun load-terminal-library ()
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
539 (when term-file-prefix
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
540 (let ((term (getenv "TERM"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
541 hyphend)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
542 (while (and term
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
543 (not (load (concat term-file-prefix term) t t)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
544 ;; Strip off last hyphen and what follows, then try again
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
545 (if (setq hyphend (string-match "[-_][^-_]+\\'" term))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
546 (setq term (substring term 0 hyphend))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
547 (setq term nil))))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (defun load-user-init-file (init-file-user)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 ;; This function actually reads the init files.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
551 (when init-file-user
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
552 (setq user-init-file
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
553 (cond
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
554 ((eq system-type 'ms-dos)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
555 (concat "~" init-file-user "/_emacs"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
556 ((eq system-type 'vax-vms)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
557 "sys$login:.emacs")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
558 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
559 (concat "~" init-file-user "/.emacs"))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
560 (load user-init-file t t t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
561 (unless inhibit-default-init
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
562 (let ((inhibit-startup-message nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
563 ;; Users are supposed to be told their rights.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
564 ;; (Plus how to get help and how to undo.)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
565 ;; Don't you dare turn this off for anyone except yourself.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
566 (load "default" t t)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 ;;; Load user's init file and default ones.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (defun load-init-file ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (run-hooks 'before-init-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 ;; Run the site-start library if it exists. The point of this file is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 ;; that it is run before .emacs. There is no point in doing this after
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 ;; .emacs; that is useless.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
575 (when site-start-file
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
576 (load site-start-file t t))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 ;; Sites should not disable this. Only individuals should disable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 ;; the startup message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (setq inhibit-startup-message nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (let (debug-on-error-from-init-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 debug-on-error-should-be-set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (debug-on-error-initial
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 (if (eq init-file-debug t) 'startup init-file-debug)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (let ((debug-on-error debug-on-error-initial))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (if init-file-debug
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 ;; Do this without a condition-case if the user wants to debug.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (load-user-init-file init-file-user)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (condition-case error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (load-user-init-file init-file-user)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (setq init-file-had-error nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (message "Error in init file: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (display-error error nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 (setq init-file-had-error t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 ;; If we can tell that the init file altered debug-on-error,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 ;; arrange to preserve the value that it set up.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (or (eq debug-on-error debug-on-error-initial)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (setq debug-on-error-should-be-set t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 debug-on-error-from-init-file debug-on-error)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
603 (when debug-on-error-should-be-set
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
604 (setq debug-on-error debug-on-error-from-init-file)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 (setq init-file-loaded t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 ;; Do this here in case the init file sets mail-host-address.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 (or user-mail-address
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 (setq user-mail-address (concat (user-login-name) "@"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 (or mail-host-address
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 (system-name)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 (run-hooks 'after-init-hook)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 (defun load-options-file (filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 "Load the file of saved options (from the Options menu) called FILENAME.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 Currently this does nothing but call `load', but it might be redefined
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 in the future to support automatically converting older options files to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 a new format, when variables have changed, etc."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 (load filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 (defun command-line-1 ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 (if (null command-line-args-left)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
626 (unless (or inhibit-startup-message
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
627 noninteractive
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 ;; Don't clobber a non-scratch buffer if init file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 ;; has selected it.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
630 (not (string= (buffer-name) "*scratch*"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
631 (input-pending-p))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
633 ;; If there are no switches to process, run the term-setup-hook
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
634 ;; before displaying the copyright notice; there may be some need
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
635 ;; to do it before doing any output. If we're not going to
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
636 ;; display a copyright notice (because other options are present)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
637 ;; then this is run after those options are processed.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
638 (run-hooks 'term-setup-hook)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
639 ;; Don't let the hook be run twice.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
640 (setq term-setup-hook nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
642 (let ((timeout nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
643 (unwind-protect
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
644 ;; Guts of with-timeout
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
645 (catch 'timeout
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
646 (setq timeout (add-timeout startup-message-timeout
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
647 (lambda (ignore)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
648 (condition-case nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
649 (throw 'timeout t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
650 (error nil)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
651 nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
652 (startup-splash-frame)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
653 (or nil;; (pos-visible-in-window-p (point-min))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
654 (goto-char (point-min)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
655 (sit-for 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
656 (setq unread-command-event (next-command-event)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
657 (when timeout (disable-timeout timeout))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
658 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
659 ;; In case the XEmacs server has already selected
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
660 ;; another buffer, erase the one our message is in.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
661 (set-buffer (get-buffer "*scratch*"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
662 (erase-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
663 (set-buffer-modified-p nil)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
664
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
665 ;; Command-line-options exist
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 (let ((dir command-line-default-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 (file-count 0)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
668 (line nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
669 (end-of-options nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
670 first-file-buffer file-p arg tem)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 (while command-line-args-left
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
672 (setq arg (pop command-line-args-left))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
673 (cond
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
674 (end-of-options
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
675 (setq file-p t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
676 ((setq tem (when (eq (aref arg 0) ?-)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
677 (or (assoc arg command-switch-alist)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
678 (assoc (substring arg 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
679 command-switch-alist))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
680 (funcall (cdr tem) arg))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
681 ((string-match "\\`\\+[0-9]+\\'" arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
682 (setq line (string-to-int arg)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
683 ;; "- file" means don't treat "file" as a switch
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
684 ;; ("+0 file" has the same effect; "-" added
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
685 ;; for unixoidiality).
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
686 ;; This is worthless; the `unixoid' way is "./file". -jwz
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
687 ((or (string= arg "-") (string= arg "--"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
688 (setq end-of-options t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
689 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
690 (setq file-p t)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
691
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
692 (when file-p
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
693 (setq file-p nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
694 (incf file-count)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
695 (setq arg (expand-file-name arg dir))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
696 (cond
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
697 ((= file-count 1) (setq first-file-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
698 (progn (find-file arg) (current-buffer))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
699 (noninteractive (find-file arg))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
700 (t (find-file-other-window arg)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
701 (when line
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
702 (goto-line line)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
703 (setq line nil))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 ;; If 3 or more files visited, and not all visible,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 ;; show user what they all are.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
706 (when (and (not noninteractive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
707 (> file-count 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
708 (not (get-buffer-window first-file-buffer)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
709 (other-window 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
710 (buffer-menu nil)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 (defvar startup-presentation-hack-keymap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 (let ((map (make-sparse-keymap)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 (set-keymap-name map 'startup-presentation-hack-keymap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 (define-key map '[button1] 'startup-presentation-hack)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 (define-key map '[button2] 'startup-presentation-hack)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 "Putting yesterday in the future tomorrow.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 (defun startup-presentation-hack ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 (let ((e last-command-event))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 (and (button-press-event-p e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 (setq e (extent-at (event-point e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 (event-buffer e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 'startup-presentation-hack))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 (setq e (extent-property e 'startup-presentation-hack))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 (if (consp e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 (apply (car e) (cdr e))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
730 (while (keymapp (indirect-function e))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
731 (let ((map e)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
732 (overriding-local-map (indirect-function e)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
733 (setq e (read-key-sequence
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
734 (let ((p (keymap-prompt map t)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
735 (cond ((symbolp map)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
736 (if p
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
737 (format "%s %s " map p)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
738 (format "%s " map)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
739 (p)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
740 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
741 (prin1-to-string map))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
742 (if (and (button-release-event-p (elt e 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
743 (null (key-binding e)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
744 (setq e map) ; try again
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
745 (setq e (key-binding e)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
746 (call-interactively e)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 (defun startup-presentation-hack-help (e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 (setq e (extent-property e 'startup-presentation-hack))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 (if (consp e)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 (format "Evaluate %S" e)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
752 (symbol-name e)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 (defun splash-frame-present-hack (e v)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
755 ;; (set-extent-property e 'mouse-face 'highlight)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
756 ;; (set-extent-property e 'keymap
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
757 ;; startup-presentation-hack-keymap)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
758 ;; (set-extent-property e 'startup-presentation-hack v)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
759 ;; (set-extent-property e 'help-echo
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
760 ;; 'startup-presentation-hack-help))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
763 (defun splash-hack-version-string ()
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
764 (save-excursion
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
765 (save-restriction
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
766 (goto-char (point-min))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
767 (re-search-forward "^XEmacs" nil t)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
768 (narrow-to-region (point-at-bol) (point-at-eol))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
769 (goto-char (point-min))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
770 (when (re-search-forward " \\[Lucid\\]" nil t)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
771 (delete-region (match-beginning 0) (match-end 0)))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
772 (when (re-search-forward "[^(].*-.*-" nil t)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
773 (delete-region (1+ (match-beginning 0)) (match-end 0))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
774 (insert "("))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
775 (goto-char (point-max))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
776 (search-backward " " nil t)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
777 (when (search-forward "." nil t)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
778 (delete-region (1- (point)) (point-max))))))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
779
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 (defun splash-frame-present (l)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 (cond ((stringp l)
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
782 (insert l)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
783 (splash-hack-version-string))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 ((eq (car-safe l) 'face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 ;; (face name string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 (let ((p (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 (splash-frame-present (elt l 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 (if (fboundp 'set-extent-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 (set-extent-face (make-extent p (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 (elt l 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 ((eq (car-safe l) 'key)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 (let* ((c (elt l 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 (p (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 (k (where-is-internal c nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 (insert (if k (key-description k)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
796 (format "M-x %s" c)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 (if (fboundp 'set-extent-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 (let ((e (make-extent p (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 (set-extent-face e 'bold)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 (splash-frame-present-hack e c)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 ((eq (car-safe l) 'funcall)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 ;; (funcall (fun . args) string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 (let ((p (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 (splash-frame-present (elt l 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 (if (fboundp 'set-extent-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 (splash-frame-present-hack (make-extent p (point))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
807 (elt l 1)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 ((consp l)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 (mapcar 'splash-frame-present l))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 (error "WTF!?"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 (defun startup-center-spaces (glyph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 ;; Return the number of spaces to insert in order to center
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 ;; the given glyph (may be a string or a pixmap).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 ;; Assume spaces are as wide as avg-pixwidth.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 ;; Won't be quite right for proportional fonts, but it's the best we can do.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 ;; Maybe the new redisplay will export something a glyph-width function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 ;;; #### Yes, there is a glyph-width function but it isn't quite what
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 ;;; #### this was expecting. Or is it?
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 ;; (An alternate way to get avg-pixwidth would be to use x-font-properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 ;; and calculate RESOLUTION_X * AVERAGE_WIDTH / 722.7, but it's no better.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 ;; This function is used in about.el too.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 (let* ((avg-pixwidth (round (/ (frame-pixel-width) (frame-width))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 (fill-area-width (* avg-pixwidth (- fill-column left-margin)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 (glyph-pixwidth (cond ((stringp glyph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 (* avg-pixwidth (length glyph)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 ;; #### the pixmap option should be removed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 ;;((pixmapp glyph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 ;; (pixmap-width glyph))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 ((glyphp glyph)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 (glyph-width glyph))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 (error "startup-center-spaces: bad arg")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 (+ left-margin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 (round (/ (/ (- fill-area-width glyph-pixwidth) 2) avg-pixwidth)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
839 (defun startup-splash-frame-body ()
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
840 `("\n" ,(emacs-version) "\n"
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
841 ,@(if (string-match "beta" emacs-version)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
842 `( (face (bold blue) ( "This is an Experimental version of XEmacs. "
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
843 " Type " (key describe-beta)
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
844 " to see what this means.\n")))
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
845 `( "\n"))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
846 (face bold-italic "\
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
847 Copyright (C) 1985-1997 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 Copyright (C) 1990-1994 Lucid, Inc.
108
360340f9fd5f Import from CVS: tag r20-1b6
cvs
parents: 76
diff changeset
849 Copyright (C) 1993-1997 Sun Microsystems, Inc. All Rights Reserved.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 Copyright (C) 1994-1996 Board of Trustees, University of Illinois
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
851 Copyright (C) 1995-1996 Ben Wing\n\n")
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
852
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
853 ,@(if (featurep 'sparcworks)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
854 `( "\
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
855 Sun provides support for the WorkShop/XEmacs integration package only.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
856 All other XEmacs packages are provided to you \"AS IS\".
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
857 For full details, type " (key describe-no-warranty)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
858 " to refer to the GPL Version 2, dated June 1991.\n\n"
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
859 ,@(let ((lang (or (getenv "LC_ALL") (getenv "LC_MESSAGES") (getenv "LANG"))))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
860 (if (and
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
861 (not (featurep 'mule)) ; Already got mule?
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
862 (not (eq 'tty (console-type))) ; No Mule support on tty's yet
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
863 lang ; Non-English locale?
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
864 (not (string= lang "C"))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
865 (not (string-match "^en" lang))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
866 (locate-file "xemacs-mule" exec-path)) ; Comes with Sun WorkShop
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
867 '( "\
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
868 This version of XEmacs has been built with support for Latin-1 languages only.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
869 To handle other languages you need to run a Multi-lingual (`Mule') version of
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
870 XEmacs, by either running the command `xemacs-mule', or by using the X resource
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
871 `ESERVE*defaultXEmacsPath: xemacs-mule' when starting XEmacs from Sun WorkShop.\n\n"))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
873 '("XEmacs comes with ABSOLUTELY NO WARRANTY; type "
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
874 (key describe-no-warranty) " for full details.\n"))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
875
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
876 "You may give out copies of XEmacs; type "
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
877 (key describe-copying) " to see the conditions.\n"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
878 "Type " (key describe-distribution)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
879 " for information on getting the latest version.\n\n"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
880
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
881 "Type " (key help-command) " or use the " (face bold "Help") " menu to get help.\n"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
882 "Type " (key advertised-undo) " to undo changes (`C-' means use the Control key).\n"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
883 "To get out of XEmacs, type " (key save-buffers-kill-emacs) ".\n"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
884 "Type " (key help-with-tutorial) " for a tutorial on using XEmacs.\n"
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
885 "Type " (key info) " to enter Info, "
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
886 "which you can use to read online documentation.\n"
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
887 (face (bold red) ( "\
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
888 For tips and answers to frequently asked questions, see the XEmacs FAQ.
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
889 \(It's on the Help menu, or type " (key xemacs-local-faq) " [a capital F!].\)"))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
890
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
891 (defun startup-splash-frame ()
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
892 (let ((p (point))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
893 (cramped-p (eq 'tty (console-type))))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
894 (unless cramped-p (insert "\n"))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
895 (indent-to (startup-center-spaces xemacs-logo))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
896 (set-extent-begin-glyph (make-extent (point) (point)) xemacs-logo)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
897 (insert (if cramped-p "\n" "\n\n"))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
898 (splash-frame-present-hack (make-extent p (point)) 'about-xemacs))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
899
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
900 (let ((after-change-functions nil)) ; no font-lock, thank you
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
901 (dolist (l (startup-splash-frame-body))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
902 (splash-frame-present l)))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
903 (set-buffer-modified-p nil))
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
904
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
905 ;; (let ((present-file
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
906 ;; #'(lambda (f)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
907 ;; (splash-frame-present
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
908 ;; (list 'funcall
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
909 ;; (list 'find-file-other-window
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
910 ;; (expand-file-name f data-directory))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
911 ;; f)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
912 ;; (insert "For customization examples, see the files ")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
913 ;; (funcall present-file "sample.emacs")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
914 ;; (insert " and ")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
915 ;; (funcall present-file "sample.Xdefaults")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
916 ;; (insert (format "\nin the directory %s." data-directory)))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
917
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 ;;;; Computing the default load-path, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 ;;; This stuff is a complete mess and isn't nearly as general as it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 ;;; thinks it is. It should be rethunk. In particular, too much logic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 ;;; is duplicated between the code that looks around for the various
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 ;;; directories, and the code which suggests where to create the various
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 ;;; directories once it decides they are missing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 ;;; The source directory has this layout:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 ;;; BUILD_ROOT/src/xemacs* argv[0]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 ;;; BUILD_ROOT/xemacs* argv[0], possibly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 ;;; BUILD_ROOT/lisp/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 ;;; BUILD_ROOT/etc/ data-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 ;;; BUILD_ROOT/info/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 ;;; BUILD_ROOT/lib-src/ exec-directory, doc-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 ;;; BUILD_ROOT/lock/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 ;;; The default tree created by "make install" has this layout:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 ;;; PREFIX/bin/xemacs* argv[0]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 ;;; PREFIX/lib/xemacs-VERSION/lisp/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 ;;; PREFIX/lib/xemacs-VERSION/etc/ data-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 ;;; PREFIX/lib/xemacs-VERSION/info/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 ;;; PREFIX/lib/xemacs-VERSION/CONFIGURATION/ exec-directory, doc-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 ;;; PREFIX/lib/xemacs/lock/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 ;;; PREFIX/lib/xemacs/site-lisp/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 ;;; The binary packages we ship have that layout, except that argv[0] has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 ;;; been moved one level deeper under the bin directory:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 ;;; PREFIX/bin/CONFIGURATION/xemacs*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 ;;; The following code has to deal with at least the above three situations,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 ;;; and it should be possible for it to deal with more. Though perhaps that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 ;;; does cover it all? The trick is, when something is missing, realizing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 ;;; which of those three layouts is mostly in place, so that we can suggest
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 ;;; the right directories in the error message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 ;; extremely low-tech debugging, since this happens so early in startup.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
960 ;;(or (fboundp 'orig-file-directory-p)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
961 ;; (fset 'orig-file-directory-p (symbol-function 'file-directory-p)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
962 ;;(defun file-directory-p (path)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
963 ;; (send-string-to-terminal (format "PROBING %S" path))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
964 ;; (let ((v (orig-file-directory-p path)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
965 ;; (send-string-to-terminal (format " -> %S\n" v))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
966 ;; v))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 (defun startup-make-version-dir ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 (let ((version (and (string-match "\\`[^0-9]*\\([0-9]+\\.[0-9]+\\)"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 (substring emacs-version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 (match-beginning 1) (match-end 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 (if (string-match "(beta *\\([0-9]+\\))" emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 (setq version (concat version "-b"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 (substring emacs-version (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 (match-end 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 (if (string-match "(alpha *\\([0-9]+\\))" emacs-version)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 (setq version (concat version "-a"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 (substring emacs-version (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 (match-end 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 (concat "lib/xemacs-" version)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 (defun find-emacs-root-internal-1 (path lisp-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 (let ((dir (file-name-directory path)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 ;; If this directory is a plausible root of the XEmacs tree, return it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 (and (or (not lisp-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 (file-directory-p (expand-file-name "lisp/prim" dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 (or (file-directory-p (expand-file-name "lib-src" dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 (file-directory-p (expand-file-name system-configuration dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 ;; If the parent of this directory is a plausible root, use it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 ;; (But don't do so recursively!)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 (and (or (not lisp-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 (file-directory-p (expand-file-name "../lisp/prim" dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 (or (file-directory-p (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 (format "../%s" system-configuration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 (file-directory-p (expand-file-name "../lib-src" dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 (expand-file-name "../" dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 ;; (--run-in-place) Same thing, but from one directory level deeper.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 (and (or (not lisp-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 (file-directory-p (expand-file-name "../../lisp/prim" dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 (or (file-directory-p (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 (format "../%s" system-configuration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 (file-directory-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 (format "../../lib-src/%s" system-configuration) dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 (expand-file-name "../.." dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 ;; If ../lib/xemacs-<version> exists check it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 ;; This is of the form "xemacs-19.10/" or "xemacs-19.10-b7/".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 (let ((ver-dir (concat "../" (startup-make-version-dir))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 (and (or (not lisp-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 (file-directory-p (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 (format "%s/lisp/prim" ver-dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 (or (file-directory-p (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 (format "%s/%s" ver-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 system-configuration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 (file-directory-p (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 (format "%s/lib-src" ver-dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 (expand-file-name (file-name-as-directory ver-dir) dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 ;; Same thing, but one higher: ../../lib/xemacs-<version>.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 (let ((ver-dir (concat "../../" (startup-make-version-dir))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 (and (or (not lisp-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 (file-directory-p (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 (format "%s/lisp/prim" ver-dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 (or (file-directory-p (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 (format "%s/%s" ver-dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 system-configuration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 (file-directory-p (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 (format "%s/lib-src" ver-dir)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 (expand-file-name (file-name-as-directory ver-dir) dir)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 ;; If that doesn't work, and the XEmacs executable is a symlink, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 ;; chase the link and try again there.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 (and (setq path (file-symlink-p path))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 (find-emacs-root-internal-1 (expand-file-name path dir) lisp-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 ;; Otherwise, this directory just doesn't cut it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 ;; Some bozos think they can use the 18.59 lisp directory with 19.*.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 ;; This is because they're not using their brains. But it might be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 ;; nice to notice that that is happening and point them in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 ;; general direction of a clue.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 nil)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 (defun find-emacs-root-internal (path)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1067 ;; (send-string-to-terminal (format "FINDING ROOT FOR %S\n" path))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 ;; first look for lisp/prim and lib-src; then just look for lib-src.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 ;; XEmacs can run (kind of) if the lisp directory is omitted, which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 ;; some people might want to do for space reasons.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 (or (find-emacs-root-internal-1 path t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 (find-emacs-root-internal-1 path nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 ;; If we don't succeed we are going to crash and burn for sure.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 ;; Try some paths relative to prefix-directory if it isn't nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 ;; This is definitely necessary in cases such as when we're used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 ;; as a login shell since we can't determine the invocation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 ;; directory in that case.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 (find-emacs-root-internal-1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 (format "%s/bin/%s" prefix-directory invocation-name) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 (find-emacs-root-internal-1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 (format "%s/bin/%s" prefix-directory invocation-name) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 (find-emacs-root-internal-1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 (format "%s/lib/%s" prefix-directory invocation-name) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 (find-emacs-root-internal-1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 (format "%s/lib/%s" prefix-directory invocation-name) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 (defun set-default-load-path ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 ;; XEmacs -- Steven Baur says invocation directory is nil if you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 ;; try to use XEmacs as a login shell.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 (or invocation-directory (setq invocation-directory default-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 (setq invocation-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 ;; don't let /tmp_mnt/... get into the load-path or exec-path.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 (abbreviate-file-name invocation-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 ;; #### FSFmacs recognizes environment vars EMACSLOCKDIR, etc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 (let* ((root (find-emacs-root-internal (concat invocation-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 invocation-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 (lisp (and root
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 (let ((f (expand-file-name "lisp" root)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 (and (file-directory-p f) f))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1102 (site-lisp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1103 (and root
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1104 (or
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1105 (let ((f (expand-file-name "xemacs/site-lisp" root)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1106 (and (file-directory-p f) f))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1107 (let ((f (expand-file-name "../xemacs/site-lisp" root)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1108 (and (file-directory-p f) f))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1109 ;; the next two are for --run-in-place
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1110 (let ((f (expand-file-name "site-lisp" root)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1111 (and (file-directory-p f) f))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1112 (let ((f (expand-file-name "lisp/site-lisp" root)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1113 (and (file-directory-p f) f))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1114 )))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1115 (lib-src
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1116 (and root
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1117 (or
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1118 (let ((f (expand-file-name
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1119 (concat "lib-src/" system-configuration)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1120 root)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1121 (and (file-directory-p f) f))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1122 (let ((f (expand-file-name "lib-src" root)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1123 (and (file-directory-p f) f))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1124 (let ((f (expand-file-name system-configuration root)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1125 (and (file-directory-p f) f)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1126 (etc
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1127 (and root
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1128 (let ((f (expand-file-name "etc" root)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1129 (and (file-directory-p f) f))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1130 (info
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1131 (and root
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1132 (let ((f (expand-file-name "info" root)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1133 (and (file-directory-p f) (file-name-as-directory f)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1134 (lock
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1135 (and root
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1136 (boundp 'lock-directory)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1137 (if (and lock-directory (file-directory-p lock-directory))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1138 (file-name-as-directory lock-directory)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1139 (or
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1140 (let ((f (expand-file-name "xemacs/lock" root)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1141 (and (file-directory-p f)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1142 (file-name-as-directory f)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1143 (let ((f (expand-file-name "../xemacs/lock" root)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1144 (and (file-directory-p f)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1145 (file-name-as-directory f)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1146 (let ((f (expand-file-name "lock" root)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1147 (and (file-directory-p f)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1148 (file-name-as-directory f)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1149 ;; if none of them exist, make the "guess" be
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1150 ;; the one that set-default-load-path-warning
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1151 ;; will suggest.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1152 (file-name-as-directory
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1153 (expand-file-name "../xemacs/lock" root))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1154 )))))
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1155
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1156 ;; 1996/12/6 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1157 ;; define `default-load-path' for file-detect.el
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1158 (setq default-load-path load-path)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1159
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 ;; add site-lisp dir to load-path
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1161 (when site-lisp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1162 ;; If the site-lisp dir isn't on the load-path, add it to the end.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1163 (or (member site-lisp load-path)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1164 (setq load-path (append load-path (list site-lisp))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1165 ;; Also add any direct subdirectories of the site-lisp directory
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1166 ;; to the load-path. But don't add dirs whose names begin
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1167 ;; with dot or hyphen.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1168 (let ((files (directory-files site-lisp nil "^[^-.]" nil 'dirs-only))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1169 file)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1170 (while files
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1171 (setq file (car files))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1172 (if (and (not (member file '("RCS" "CVS" "SCCS")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1173 (setq file (expand-file-name file site-lisp))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1174 (not (member file load-path)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1175 (setq load-path
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1176 (nconc load-path
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1177 (list (file-name-as-directory file)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1178 (setq files (cdr files)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1179
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 ;; add lisp dir to load-path
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1181 (when lisp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1182 ;; If the lisp dir isn't on the load-path, add it to the end.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1183 (or (member lisp load-path)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1184 (setq load-path (append load-path (list lisp))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1185 ;; Also add any direct subdirectories of the lisp directory
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1186 ;; to the load-path. But don't add dirs whose names begin
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1187 ;; with dot or hyphen.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1188 (let ((files (directory-files lisp nil "^[^-.]" nil 'dirs-only))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1189 file)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1190 (while files
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1191 (setq file (car files))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1192 (when (and (not (member file '("RCS" "CVS" "SCCS")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1193 (setq file (expand-file-name file lisp))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1194 (not (member file load-path)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1195 (setq load-path
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1196 (nconc load-path
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1197 (list (file-name-as-directory file)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1198 (setq files (cdr files)))))
32
e04119814345 Import from CVS: tag r19-15b99
cvs
parents: 30
diff changeset
1199
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1200 ;; 1996/12/6 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1201 ;; define `default-load-path' for file-detect.el
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1202 (setq default-load-path
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1203 (append default-load-path
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1204 (if site-lisp
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1205 (list site-lisp))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1206 (if lisp
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1207 (list lisp)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1208 )
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1209 ))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
1210
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
1211 ;; 1997/03/06 by Jeff Miller <jmiller@bayserve.net>
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
1212 ;; initialize 'site-directory'. This is the site-lisp dir used by
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
1213 ;; XEmacs
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
1214 (if site-lisp
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
1215 (setq site-directory (file-name-as-directory site-lisp))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 108
diff changeset
1216 )
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 ;; If running from the build directory, always prefer the exec-directory
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1218 ;; that is here over to the one that came from paths.h.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1219 (when (or (and (null exec-directory) lib-src)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1220 (and (string= lib-src (expand-file-name "lib-src" root))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1221 (not (string= exec-directory lib-src))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1222 (setq exec-directory (file-name-as-directory lib-src)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1223 (when (or (and (null doc-directory) lib-src)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1224 (and (string= lib-src (expand-file-name "lib-src" root))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1225 (not (string= doc-directory lib-src))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1226 (setq doc-directory (file-name-as-directory lib-src)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1228 (when exec-directory
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1229 (or (member exec-directory exec-path)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1230 (setq exec-path (append exec-path (list exec-directory)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1231 (when (or (and (null data-directory) etc)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1232 (and (string= etc (expand-file-name "etc" root))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1233 (not (string= data-directory etc))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1234 (setq data-directory (file-name-as-directory etc)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 ;; If `configure' specified an info dir, use it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 (or (boundp 'Info-default-directory-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 (setq Info-default-directory-list nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 (cond (configure-info-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 (setq configure-info-directory (file-name-as-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 configure-info-directory))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 (or (member configure-info-directory Info-default-directory-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 (setq Info-default-directory-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 (append Info-default-directory-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 (list configure-info-directory))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 ;; If we've guessed the info dir, use that (too).
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1249 (when (and info (not (member info Info-default-directory-list)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1250 (setq Info-default-directory-list
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1251 (append Info-default-directory-list (list info))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 ;; Default the lock dir to being a sibling of the data-directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 ;; If superlock isn't set, or is set to a file in a nonexistent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 ;; directory, derive it from the lock dir.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1256 (when (boundp 'lock-directory)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1257 (setq lock-directory lock)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1258 (cond ((null lock-directory)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1259 (setq superlock-file nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1260 ((or (null superlock-file)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1261 (not (file-directory-p
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1262 (file-name-directory superlock-file))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1263 (setq superlock-file
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1264 (expand-file-name "!!!SuperLock!!!"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1265 lock-directory)))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 (set-default-load-path-warning)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 (defun set-default-load-path-warning ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 (let ((lock (if (boundp 'lock-directory) lock-directory 't))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 warnings message guess)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1273 (when (and (stringp lock) (not (file-directory-p lock)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1274 (setq lock nil))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 (cond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 ((not (and exec-directory data-directory doc-directory load-path lock))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 (set-buffer (get-buffer-create " *warning-tmp*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 (buffer-disable-undo (current-buffer))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1281 (when (null lock) (push "lock-directory" warnings))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1282 (when (null exec-directory) (push "exec-directory" warnings))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1283 (when (null data-directory) (push "data-directory" warnings))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1284 (when (null doc-directory) (push "doc-directory" warnings))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1285 (when (null load-path) (push "load-path" warnings))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 (cond ((cdr (cdr warnings))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 (setq message (apply 'format "%s, %s, and %s" warnings)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 ((cdr warnings)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 (setq message (apply 'format "%s and %s" warnings)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 (t (setq message (format "variable %s" (car warnings)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 (insert "couldn't find an obvious default for " message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 ", and there were no defaults specified in paths.h when "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 "XEmacs was built. Perhaps some directories don't exist, "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 "or the XEmacs executable, " (concat invocation-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 invocation-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 " is in a strange place?")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 (setq guess (or exec-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 data-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 doc-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 (car load-path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 (and (string-match "/[^/]+\\'" invocation-directory)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 (substring invocation-directory 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 (match-beginning 0)))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1304 (when (and guess
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1305 (or
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1306 ;; parent of a terminal bin/<configuration> pair (hack hack).
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1307 (string-match (concat "/bin/"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1308 (regexp-quote system-configuration)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1309 "/?\\'")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1310 guess)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1311 ;; parent of terminal src, lib-src, etc, or lisp dir.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1312 (string-match
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1313 "/\\(bin\\|src\\|lib-src\\|etc\\|lisp\\)[^/]*/?\\'"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1314 guess)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1315 (setq guess (substring guess 0 (match-beginning 0))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 ;; If neither the exec nor lisp dirs are around, then "guess" that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 ;; the new configure-style lib dir should be used. Otherwise, if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 ;; only one of them appears to be missing, or it's just lock,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320 ;; then guess it to be a sibling of whatever already exists.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1321 (when (and (null exec-directory) (null load-path))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1322 (setq guess (expand-file-name (startup-make-version-dir) guess)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1324 (when (or (null exec-directory) (null load-path))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1325 (insert
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1326 "\n\nWithout both exec-directory and load-path, XEmacs will "
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1327 "be very broken. "))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1328 (when (and (null exec-directory) guess)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1329 (insert
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1330 "Consider making a symbolic link from "
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1331 (expand-file-name system-configuration guess)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1332 " to wherever the appropriate XEmacs exec-directory "
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1333 "directory is"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1334 (when (and (null data-directory) guess)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1335 (insert
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1336 (if exec-directory
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1337 "\n\nConsider making a symbolic link " ", and ")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1338 "from "
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1339 (expand-file-name "etc" (if load-path
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1340 (file-name-directory
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1341 (directory-file-name
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1342 (car load-path)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1343 guess))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1344 " to wherever the appropriate XEmacs data-directory is"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1345 (when (and (null load-path) guess)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1346 (insert
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1347 (if (and exec-directory data-directory)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1348 "Consider making a symbolic link "
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1349 ", and ")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1350 "from "
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1351 (expand-file-name "lisp" guess)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1352 " to wherever the appropriate XEmacs lisp library is"))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 (insert ".")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1355 (when (null lock)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1356 (insert
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1357 "\n\nWithout lock-directory set, file locking won't work. ")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1358 (when guess
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1359 (insert
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1360 "Consider creating "
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1361 (expand-file-name "../xemacs/lock"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1362 (or (find-emacs-root-internal
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1363 (concat invocation-directory
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1364 invocation-name))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1365 guess))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1366 " as a directory or symbolic link for use as the lock "
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1367 "directory. (This directory must be globally writable.)"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1368 )))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1370 (when (fboundp 'fill-region)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1371 ;; Might not be bound in the cold load environment...
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1372 (let ((fill-column 76))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 44
diff changeset
1373 (fill-region (point-min) (point-max))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375 (princ "\nWARNING:\n" 'external-debugging-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 (princ (buffer-string) 'external-debugging-output)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378 t)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 ;;; startup.el ends here