annotate lisp/startup.el @ 453:270b05afd845

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