annotate lisp/prim/startup.el @ 12:bcdc7deadc19 r19-15b7

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