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