annotate lisp/startup.el @ 239:41f2f0e326e9 r20-5b18

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