annotate lisp/prim/startup.el @ 183:e121b013d1f0 r20-3b18

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