annotate lisp/prim/startup.el @ 171:929b76928fce r20-3b12

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