annotate lisp/startup.el @ 276:6330739388db r21-0b36

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