Sync up with r21-2-27.
[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 (cond
111                              ((eq system-type 'ms-dos) "_emacs")
112                              (t ".emacs"))
113   "Base of init file.")
114
115 (defvar user-init-directory
116   (file-name-as-directory
117    (paths-construct-path (list "~" user-init-directory-base)))
118   "Directory where user-installed init files may go.")
119
120 (defvar load-user-init-file-p t
121   "Non-nil if XEmacs should load the user's init file.")
122
123 ;; #### called `site-run-file' in FSFmacs
124
125 (defvar site-start-file (purecopy "site-start")
126   "File containing site-wide run-time initializations.
127 This file is loaded at run-time before `.emacs'.  It
128 contains inits that need to be in place for the entire site, but
129 which, due to their higher incidence of change, don't make sense to
130 load into XEmacs' dumped image.  Thus, the run-time load order is:
131
132   1. file described in this variable, if non-nil;
133   2. `.emacs';
134   3. `/path/to/xemacs/lisp/default.el'.
135
136 Don't use the `site-start.el' file for things some users may not like.
137 Put them in `default.el' instead, so that users can more easily
138 override them.  Users can prevent loading `default.el' with the `-q'
139 option or by setting `inhibit-default-init' in their own init files,
140 but inhibiting `site-start.el' requires `--no-site-file', which
141 is less convenient.")
142
143 ;;(defconst iso-8859-1-locale-regexp "8859[-_]?1"
144 ;;  "Regexp that specifies when to enable the ISO 8859-1 character set.
145 ;;We do that if this regexp matches the locale name
146 ;;specified by the LC_ALL, LC_CTYPE and LANG environment variables.")
147
148 (defvar mail-host-address nil
149   "*Name of this machine, for purposes of naming users.")
150
151 (defvar user-mail-address nil
152   "*Full mailing address of this user.
153 This is initialized based on `mail-host-address',
154 after your init file is read, in case it sets `mail-host-address'.")
155
156 (defvar auto-save-list-file-prefix "~/.saves-"
157   "Prefix for generating auto-save-list-file-name.
158 Emacs's pid and the system name will be appended to
159 this prefix to create a unique file name.")
160
161 (defvar init-file-debug nil)
162
163 (defvar init-file-had-error nil)
164
165 (defvar init-file-loaded nil
166   "True after the user's init file has been loaded (or suppressed with -q).
167 This will be true when `after-init-hook' is run and at all times
168 after, and will not be true at any time before.")
169
170 (defvar initial-frame-unmapped-p nil)
171
172 \f
173
174 (defvar command-switch-alist
175   (purecopy
176    '(("-help"   . command-line-do-help)
177      ("-version". command-line-do-version)
178      ("-V"      . command-line-do-version)
179      ("-funcall". command-line-do-funcall)
180      ("-f"      . command-line-do-funcall)
181      ("-e"      . command-line-do-funcall-1)
182      ("-eval"   . command-line-do-eval)
183      ("-load"   . command-line-do-load)
184      ("-l"      . command-line-do-load)
185      ("-insert" . command-line-do-insert)
186      ("-i"      . command-line-do-insert)
187      ("-kill"   . command-line-do-kill)
188      ;; Options like +35 are handled specially.
189      ;; Window-system, site, or package-specific code might add to this.
190      ;; X11 handles its options by letting Xt remove args from this list.
191      ))
192   "Alist of command-line switches.
193 Elements look like (SWITCH-STRING . HANDLER-FUNCTION).
194 HANDLER-FUNCTION receives switch name as sole arg;
195 remaining command-line args are in the variable `command-line-args-left'.")
196
197 ;;; default switches
198 ;;; Note: these doc strings are semi-magical.
199
200 (defun command-line-do-help (arg)
201   "Print the XEmacs usage message and exit."
202   (let ((standard-output 'external-debugging-output))
203     (princ (concat "\n" (emacs-version) "\n\n"))
204     (princ
205      (if (featurep 'x)
206          (concat "When creating a window on an X display, "
207                  (emacs-name)
208                  " accepts all standard X Toolkit
209 command line options plus the following:
210   -iconname <title>     Use title as the icon name.
211   -mc <color>           Use color as the mouse color.
212   -cr <color>           Use color as the text-cursor foregound color.
213   -private              Install a private colormap.
214
215 In addition, the")
216        "The"))
217     (princ " following options are accepted:
218   -t <device>           Use TTY <device> instead of the terminal for input
219                         and output.  This implies the -nw option.
220   -nw                   Inhibit the use of any window-system-specific
221                         display code: use the current tty.
222   -batch                Execute noninteractively (messages go to stderr).
223   -debug-init           Enter the debugger if an error in the init file occurs.
224   -unmapped             Do not map the initial frame.
225   -no-site-file         Do not load the site-specific init file (site-start.el).
226   -no-init-file         Do not load the user-specific init file (~/.emacs).
227   -no-early-packages    Do not process early packages.
228   -no-autoloads         Do not load global symbol files (auto-autoloads) at
229                         startup.  Also implies `-vanilla'.
230   -vanilla              Equivalent to -q -no-site-file -no-early-packages.
231   -q                    Same as -no-init-file.
232   -user-init-file <file> Use <file> as init file.
233   -user-init-directory <directory> use <directory> as init directory.
234   -user <user>          Load user's init file instead of your own.
235                         Equivalent to -user-init-file ~<user>/.emacs
236                                       -user-init-directory ~<user>/.xemacs/
237   -u <user>             Same as -user.\n")
238    (let ((l command-switch-alist)
239           (insert (lambda (&rest x)
240                     (princ "  ")
241                     (let ((len 2))
242                       (while x
243                         (princ (car x))
244                         (incf len (length (car x)))
245                         (setq x (cdr x)))
246                       (when (>= len 24)
247                         (terpri) (setq len 0))
248                       (while (< len 24)
249                         (princ " ")
250                         (incf len))))))
251       (while l
252         (let ((name (car (car l)))
253               (fn (cdr (car l)))
254               doc arg cons)
255           (cond
256            ((and (symbolp fn) (get fn 'undocumented)) nil)
257            (t
258             (setq doc (documentation fn))
259             (if (member doc '(nil "")) (setq doc "(undocumented)"))
260             (cond ((string-match "\n\\(<.*>\\)\n?\\'" doc)
261                    ;; Doc of the form "The frobber switch\n<arg1> <arg2>"
262                    (setq arg (substring doc (match-beginning 1) (match-end 1))
263                          doc (substring doc 0 (match-beginning 0))))
264                   ((string-match "\n+\\'" doc)
265                    (setq doc (substring doc 0 (match-beginning 0)))))
266             (if (and (setq cons (rassq fn command-switch-alist))
267                      (not (eq cons (car l))))
268                 (setq doc (format "Same as %s." (car cons))))
269             (if arg
270                 (funcall insert name " " arg)
271               (funcall insert name))
272             (princ doc)
273             (terpri))))
274         (setq l (cdr l))))
275     (princ (concat "\
276   +N <file>             Start displaying <file> at line N.
277
278 Anything else is considered a file name, and is placed into a buffer for
279 editing.
280
281 " (emacs-name) " has an online tutorial and manuals.  Type ^Ht (Control-h t) after
282 starting XEmacs to run the tutorial.  Type ^Hi to enter the manual browser.
283 Type ^H^H^H (Control-h Control-h Control-h) to get more help options.\n")
284
285     (kill-emacs 0))))
286
287 (defun command-line-do-funcall (arg)
288   "Invoke the named lisp function with no arguments.
289 <function>"
290   (funcall (intern (pop command-line-args-left))))
291 (fset 'command-line-do-funcall-1 'command-line-do-funcall)
292 (put 'command-line-do-funcall-1 'undocumented t)
293
294 (defun command-line-do-eval (arg)
295   "Evaluate the lisp form.  Quote it carefully.
296 <form>"
297   (eval (read (pop command-line-args-left))))
298
299 (defun command-line-do-load (arg)
300   "Load the named file of Lisp code into XEmacs.
301 <file>"
302   (let ((file (pop command-line-args-left)))
303     ;; Take file from default dir if it exists there;
304     ;; otherwise let `load' search for it.
305     (if (file-exists-p (expand-file-name file))
306         (setq file (expand-file-name file)))
307     (load file nil t)))
308
309 (defun command-line-do-insert (arg)
310   "Insert file into the current buffer.
311 <file>"
312   (insert-file-contents (pop command-line-args-left)))
313
314 (defun command-line-do-kill (arg)
315   "Exit XEmacs."
316   (kill-emacs t))
317
318 (defun command-line-do-version (arg)
319   "Print version info and exit."
320   (princ (concat (emacs-version) "\n"))
321   (kill-emacs 0))
322
323 \f
324 ;;; Processing the command line and loading various init files
325
326 (defun early-error-handler (&rest debugger-args)
327   "You should probably not be using this."
328   ;; Used as the debugger during XEmacs initialization; if an error occurs,
329   ;; print some diagnostics, and kill XEmacs.
330
331   ;; output the contents of the warning buffer, since it won't be seen
332   ;; otherwise.
333   ;; #### kludge!  The call to Feval forces the pending warnings to
334   ;; get output.  There definitely needs to be a better way.
335   (let ((buffer (eval (get-buffer-create "*Warnings*"))))
336     (princ (buffer-substring (point-min buffer) (point-max buffer) buffer)
337            'external-debugging-output))
338
339   (let ((string "Initialization error")
340         (error (nth 1 debugger-args))
341         (debug-on-error nil)
342         (stream 'external-debugging-output))
343     (if (null error)
344         (princ string stream)
345       (princ (concat "\n" string ": ") stream)
346       (condition-case ()
347           (display-error error stream)
348         (error (princ "<<< error printing error message >>>" stream)))
349       (princ "\n" stream)
350       (if (memq (car-safe error) '(void-function void-variable))
351           (princ "
352         This probably means that XEmacs is picking up an old version of
353         the lisp library, or that some .elc files are not up-to-date.\n"
354                  stream)))
355     (when (not suppress-early-error-handler-backtrace)
356       (let ((print-length 1000)
357             (print-level 1000)
358             (print-escape-newlines t)
359             (print-readably nil))
360         (when (getenv "EMACSLOADPATH")
361           (princ (format "\n$EMACSLOADPATH is %s" (getenv "EMACSLOADPATH"))
362                  stream))
363         (princ (format "\nexec-directory is %S" exec-directory) stream)
364         (princ (format "\ndata-directory is %S" data-directory) stream)
365         (princ (format "\ndata-directory-list is %S" data-directory-list) stream)
366         (princ (format "\ndoc-directory is %S" doc-directory) stream)
367         (princ (format "\nload-path is %S" load-path) stream)
368         (princ "\n\n" stream)))
369     (when (not suppress-early-error-handler-backtrace)
370       (backtrace stream t)))
371   (kill-emacs -1))
372
373 (defvar lock-directory)
374 (defvar superlock-file)
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
539                 (paths-construct-path (list home-user user-init-file-base)))
540           (setq user-init-directory
541                 (file-name-as-directory
542                  (paths-construct-path (list home-user user-init-directory-base))))))
543        ((string= arg "-debug-init")
544         (setq init-file-debug t))
545        ((string= arg "-unmapped")
546         (setq initial-frame-unmapped-p t))
547        ((or (string= arg "-debug-paths")
548             (string= arg "--debug-paths"))
549         t)
550        ((or (string= arg "--") (string= arg "-"))
551         (while args
552           (push (pop args) new-args)))
553        (t (push arg new-args))))
554
555     (setq init-file-user (and load-user-init-file-p ""))
556
557     (nreverse new-args)))
558
559 (defconst initial-scratch-message "\
560 ;; This buffer is for notes you don't want to save, and for Lisp evaluation.
561 ;; If you want to create a file, first visit that file with C-x C-f,
562 ;; then enter the text in that file's own buffer.
563
564 "
565   "Initial message displayed in *scratch* buffer at startup.
566 If this is nil, no message will be displayed.")
567
568 (defun command-line ()
569   (let ((command-line-args-left (cdr command-line-args)))
570
571     (let ((debugger 'early-error-handler)
572           (debug-on-error t))
573
574       ;; Process magic command-line switches like -q and -u.  Do this
575       ;; before creating the first frame because some of these switches
576       ;; may affect that.  I think it's ok to do this before establishing
577       ;; the X connection, and maybe someday things like -nw can be
578       ;; handled here instead of down in C.
579       (setq command-line-args-left (command-line-early command-line-args-left))
580
581       ;; Setup the toolbar icon directory
582       (when (featurep 'toolbar)
583         (init-toolbar-location))
584
585       ;; Run the window system's init function.  tty is considered to be
586       ;; a type of window system for this purpose.  This creates the
587       ;; initial (non stdio) device.
588       (when (and initial-window-system (not noninteractive))
589         (funcall (intern (concat "init-"
590                                  (symbol-name initial-window-system)
591                                  "-win"))))
592
593       ;; When not in batch mode, this creates the first visible frame,
594       ;; and deletes the stdio device.
595       (frame-initialize))
596
597     ;;
598     ;; We have normality, I repeat, we have normality.  Anything you still
599     ;; can't cope with is therefore your own problem.  (And we don't need
600     ;; to kill XEmacs for it.)
601     ;;
602
603     ;;; Load init files.
604     (load-init-file)
605
606     (with-current-buffer (get-buffer "*scratch*")
607       (erase-buffer)
608       ;; (insert initial-scratch-message)
609       (set-buffer-modified-p nil)
610       (when (eq major-mode 'fundamental-mode)
611         (funcall initial-major-mode)))
612
613     ;; Load library for our terminal type.
614     ;; User init file can set term-file-prefix to nil to prevent this.
615     ;; Note that for any TTY's opened subsequently, the TTY init
616     ;; code will run this.
617     (when (and (eq 'tty (console-type))
618                (not (noninteractive)))
619       (load-terminal-library))
620
621     ;; Process the remaining args.
622     (command-line-1)
623
624     ;; it was turned on by default so that the warnings don't get displayed
625     ;; until after the splash screen.
626     (setq inhibit-warning-display nil)
627     ;; If -batch, terminate after processing the command options.
628     (when (noninteractive) (kill-emacs t))))
629
630 (defun load-terminal-library ()
631   (when term-file-prefix
632     (let ((term (getenv "TERM"))
633           hyphend)
634       (while (and term
635                   (not (load (concat term-file-prefix term) t t)))
636         ;; Strip off last hyphen and what follows, then try again
637         (if (setq hyphend (string-match "[-_][^-_]+\\'" term))
638             (setq term (substring term 0 hyphend))
639           (setq term nil))))))
640
641 (defun load-user-init-file ()
642   "This function actually reads the init file, .emacs."
643   (if (not user-init-file)
644       (setq user-init-file
645             (paths-construct-path (list "~" user-init-file-base))))
646   (load user-init-file t t t)
647   (unless inhibit-default-init
648     (let ((inhibit-startup-message nil))
649       ;; Users are supposed to be told their rights.
650       ;; (Plus how to get help and how to undo.)
651       ;; Don't you dare turn this off for anyone except yourself.
652       (load "default" t t))))
653
654 ;;; Load user's init file and default ones.
655 (defun load-init-file ()
656   (run-hooks 'before-init-hook)
657
658   ;; Run the site-start library if it exists.  The point of this file is
659   ;; that it is run before .emacs.  There is no point in doing this after
660   ;; .emacs; that is useless.
661   (when site-start-file
662     (load site-start-file t t))
663
664   ;; Sites should not disable this.  Only individuals should disable
665   ;; the startup message.
666   (setq inhibit-startup-message nil)
667
668   (let (debug-on-error-from-init-file
669         debug-on-error-should-be-set
670         (debug-on-error-initial
671          (if (eq init-file-debug t) 'startup init-file-debug)))
672     (let ((debug-on-error debug-on-error-initial))
673       (if (and load-user-init-file-p init-file-debug)
674           ;; Do this without a condition-case if the user wants to debug.
675           (load-user-init-file)
676         (condition-case error
677             (progn
678               (if load-user-init-file-p
679                   (load-user-init-file))
680               (setq init-file-had-error nil))
681           (error
682            (message "Error in init file: %s" (error-message-string error))
683            (display-warning 'initialization
684              (format "\
685 An error has occurred while loading %s:
686
687 %s
688
689 To ensure normal operation, you should investigate the cause of the error
690 in your initialization file and remove it.  Use the `-debug-init' option
691 to XEmacs to view a complete error backtrace."
692                      user-init-file (error-message-string error))
693              'error)
694            (setq init-file-had-error t))))
695       ;; If we can tell that the init file altered debug-on-error,
696       ;; arrange to preserve the value that it set up.
697       (or (eq debug-on-error debug-on-error-initial)
698           (setq debug-on-error-should-be-set t
699                 debug-on-error-from-init-file debug-on-error)))
700     (when debug-on-error-should-be-set
701       (setq debug-on-error debug-on-error-from-init-file)))
702
703   (setq init-file-loaded t)
704
705   ;; Do this here in case the init file sets mail-host-address.
706   ;; Don't do this here unless noninteractive, it is frequently wrong. -sb
707   ;; (or user-mail-address
708   (when noninteractive
709     (setq user-mail-address (concat (user-login-name) "@"
710                                     (or mail-host-address
711                                         (system-name)))))
712
713   (run-hooks 'after-init-hook)
714   nil)
715
716 (defun load-options-file (filename)
717   "Load the file of saved options (from the Options menu) called FILENAME.
718 Currently this does nothing but call `load', but it might be redefined
719 in the future to support automatically converting older options files to
720 a new format, when variables have changed, etc."
721   (load filename))
722
723 (defun command-line-1 ()
724   (cond
725    ((null command-line-args-left)
726     (unless noninteractive
727       ;; If there are no switches to process, run the term-setup-hook
728       ;; before displaying the copyright notice; there may be some need
729       ;; to do it before doing any output.  If we're not going to
730       ;; display a copyright notice (because other options are present)
731       ;; then this is run after those options are processed.
732       (run-hooks 'term-setup-hook)
733       ;; Don't let the hook be run twice.
734       (setq term-setup-hook nil)
735
736       ;; Don't clobber a non-scratch buffer if init file
737       ;; has selected it.
738       (when (string= (buffer-name) "*scratch*")
739         (unless (or inhibit-startup-message
740                     (input-pending-p))
741           (let (tmout circ-tmout)
742             (unwind-protect
743                 ;; Guts of with-timeout
744                 (catch 'tmout
745                   (setq tmout (add-timeout startup-message-timeout
746                                            (lambda (ignore)
747                                              (condition-case nil
748                                                  (throw 'tmout t)
749                                                (error nil)))
750                                            nil))
751                   (setq circ-tmout (display-splash-frame))
752                   (or nil;; (pos-visible-in-window-p (point-min))
753                       (goto-char (point-min)))
754                   (sit-for 0)
755                   (setq unread-command-event (next-command-event)))
756               (when tmout (disable-timeout tmout))
757               (when circ-tmout (disable-timeout circ-tmout)))))
758         (with-current-buffer (get-buffer "*scratch*")
759           ;; In case the XEmacs server has already selected
760           ;; another buffer, erase the one our message is in.
761           (erase-buffer)
762           (when (stringp initial-scratch-message)
763             (insert initial-scratch-message))
764           (set-buffer-modified-p nil)))))
765
766    (t
767     ;; Command-line-options exist
768     (let ((dir command-line-default-directory)
769           (file-count 0)
770           (line nil)
771           (end-of-options nil)
772           first-file-buffer file-p arg tem)
773       (while command-line-args-left
774         (setq arg (pop command-line-args-left))
775         (cond
776          (end-of-options
777           (setq file-p t))
778          ((setq tem (when (eq (aref arg 0) ?-)
779                       (or (assoc arg command-switch-alist)
780                           (assoc (substring arg 1)
781                                  command-switch-alist))))
782           (funcall (cdr tem) arg))
783          ((string-match "\\`\\+[0-9]+\\'" arg)
784           (setq line (string-to-int arg)))
785          ;; "- file" means don't treat "file" as a switch
786          ;;  ("+0 file" has the same effect; "-" added
787          ;;   for unixoidiality).
788          ;; This is worthless; the `unixoid' way is "./file". -jwz
789          ((or (string= arg "-") (string= arg "--"))
790           (setq end-of-options t))
791          (t
792           (setq file-p t)))
793
794         (when file-p
795           (setq file-p nil)
796           (incf file-count)
797           (setq arg (expand-file-name arg dir))
798           (cond
799            ((= file-count 1) (setq first-file-buffer
800                                    (progn (find-file arg) (current-buffer))))
801            (noninteractive (find-file arg))
802            (t (find-file-other-window arg)))
803           (when line
804             (goto-line line)
805             (setq line nil))))))))
806
807 (defvar startup-presentation-hack-keymap
808   (let ((map (make-sparse-keymap)))
809     (set-keymap-name map 'startup-presentation-hack-keymap)
810     (define-key map '[button1] 'startup-presentation-hack)
811     (define-key map '[button2] 'startup-presentation-hack)
812     map)
813   "Putting yesterday in the future tomorrow.")
814
815 (defun startup-presentation-hack ()
816   (interactive)
817   (let ((e last-command-event))
818     (and (button-press-event-p e)
819          (setq e (extent-at (event-point e)
820                             (event-buffer e)
821                             'startup-presentation-hack))
822          (setq e (extent-property e 'startup-presentation-hack))
823          (if (consp e)
824              (apply (car e) (cdr e))
825            (while (keymapp (indirect-function e))
826              (let ((map e)
827                    (overriding-local-map (indirect-function e)))
828                (setq e (read-key-sequence
829                         (let ((p (keymap-prompt map t)))
830                           (cond ((symbolp map)
831                                  (if p
832                                      (format "%s %s " map p)
833                                    (format "%s " map)))
834                                 (p)
835                                 (t
836                                  (prin1-to-string map))))))
837                (if (and (button-release-event-p (elt e 0))
838                         (null (key-binding e)))
839                    (setq e map)         ; try again
840                  (setq e (key-binding e)))))
841            (call-interactively e)))))
842
843 (defun startup-presentation-hack-help (e)
844   (setq e (extent-property e 'startup-presentation-hack))
845   (if (consp e)
846       (format "Evaluate %S" e)
847     (symbol-name e)))
848
849 (defun splash-frame-present-hack (e v)
850   ;;   (set-extent-property e 'mouse-face 'highlight)
851   ;;   (set-extent-property e 'keymap
852   ;;                           startup-presentation-hack-keymap)
853   ;;   (set-extent-property e 'startup-presentation-hack v)
854   ;;   (set-extent-property e 'help-echo
855   ;;                           'startup-presentation-hack-help)
856   )
857
858 (defun splash-hack-version-string ()
859   (save-excursion
860     (save-restriction
861       (goto-char (point-min))
862       (re-search-forward "^XEmacs" nil t)
863       (narrow-to-region (point-at-bol) (point-at-eol))
864       (goto-char (point-min))
865       (when (re-search-forward " \\[Lucid\\]" nil t)
866         (delete-region (match-beginning 0) (match-end 0)))
867       (when (re-search-forward "[^(][^)]*-[^)]*-" nil t)
868         (delete-region (1+ (match-beginning 0)) (match-end 0))
869         (insert "("))
870       (goto-char (point-max))
871       (search-backward " " nil t)
872       (when (search-forward "." nil t)
873         (delete-region (1- (point)) (point-max))))))
874
875 (defun splash-frame-present (l)
876   (cond ((stringp l)
877          (insert l))
878         ((eq (car-safe l) 'face)
879          ;; (face name string)
880          (let ((p (point)))
881            (splash-frame-present (elt l 2))
882            (if (fboundp 'set-extent-face)
883                (set-extent-face (make-extent p (point))
884                                 (elt l 1)))))
885         ((eq (car-safe l) 'key)
886          (let* ((c (elt l 1))
887                 (p (point))
888                 (k (where-is-internal c nil t)))
889            (insert (if k (key-description k)
890                      (format "M-x %s" c)))
891            (if (fboundp 'set-extent-face)
892                (let ((e (make-extent p (point))))
893                  (set-extent-face e 'bold)
894                  (splash-frame-present-hack e c)))))
895         ((eq (car-safe l) 'funcall)
896          ;; (funcall (fun . args) string)
897          (let ((p (point)))
898            (splash-frame-present (elt l 2))
899            (if (fboundp 'set-extent-face)
900                (splash-frame-present-hack (make-extent p (point))
901                                           (elt l 1)))))
902         ((consp l)
903          (mapcar 'splash-frame-present l))
904         (t
905          (error "WTF!?"))))
906
907 (defun startup-center-spaces (glyph)
908   ;; Return the number of spaces to insert in order to center
909   ;; the given glyph (may be a string or a pixmap).
910   ;; Assume spaces are as wide as avg-pixwidth.
911   ;; Won't be quite right for proportional fonts, but it's the best we can do.
912   ;; Maybe the new redisplay will export something a glyph-width function.
913   ;;; #### Yes, there is a glyph-width function but it isn't quite what
914   ;;; #### this was expecting.  Or is it?
915   ;; (An alternate way to get avg-pixwidth would be to use x-font-properties
916   ;; and calculate RESOLUTION_X * AVERAGE_WIDTH / 722.7, but it's no better.)
917
918   ;; This function is used in about.el too.
919   (let* ((avg-pixwidth     (round (/ (frame-pixel-width) (frame-width))))
920          (fill-area-width  (* avg-pixwidth (- fill-column left-margin)))
921          (glyph-pixwidth   (cond ((stringp glyph)
922                                   (* avg-pixwidth (length glyph)))
923                                  ;; #### the pixmap option should be removed
924                                  ;;((pixmapp glyph)
925                                  ;; (pixmap-width glyph))
926                                  ((glyphp glyph)
927                                   (glyph-width glyph))
928                                  (t
929                                   (error "startup-center-spaces: bad arg")))))
930     (+ left-margin
931        (round (/ (/ (- fill-area-width glyph-pixwidth) 2) avg-pixwidth)))))
932
933 (defun splash-frame-body ()
934   `[((face (blue bold underline)
935            "\nDistribution, copying license, warranty:\n\n")
936      "Please visit the XEmacs website at http://www.xemacs.org !\n\n"
937      ,@(if (featurep 'sparcworks)
938            `( "\
939 Sun provides support for the WorkShop/XEmacs integration package only.
940 All other XEmacs packages are provided to you \"AS IS\".\n"
941               ,@(let ((lang (or (getenv "LC_ALL") (getenv "LC_MESSAGES")
942                                 (getenv "LANG"))))
943                   (if (and
944                        (not (featurep 'mule)) ;; Already got mule?
945                        ;; No Mule support on tty's yet
946                        (not (eq 'tty (console-type)))
947                        lang ;; Non-English locale?
948                        (not (string= lang "C"))
949                        (not (string-match "^en" lang))
950                        ;; Comes with Sun WorkShop
951                        (locate-file "xemacs-mule" exec-path))
952                       '( "\
953 This version of XEmacs has been built with support for Latin-1 languages only.
954 To handle other languages you need to run a Multi-lingual (`Mule') version of
955 XEmacs, by either running the command `xemacs-mule', or by using the X resource
956 `ESERVE*defaultXEmacsPath: xemacs-mule' when starting XEmacs from Sun WorkShop.
957 \n")))))
958      ((key describe-no-warranty)
959       ": "(face (red bold) "XEmacs comes with ABSOLUTELY NO WARRANTY\n"))
960      ((key describe-copying)
961       ": conditions to give out copies of XEmacs\n")
962      ((key describe-distribution)
963       ": how to get the latest version\n")
964      "\n--\n"
965      (face italic "\
966 Copyright (C) 1985-1999 Free Software Foundation, Inc.
967 Copyright (C) 1990-1994 Lucid, Inc.
968 Copyright (C) 1993-1997 Sun Microsystems, Inc. All Rights Reserved.
969 Copyright (C) 1994-1996 Board of Trustees, University of Illinois
970 Copyright (C) 1995-1996 Ben Wing
971 Copyright (C) 1996-2000 MORIOKA Tomohiko
972 "))
973
974     ((face (blue bold underline) "\nInformation, on-line help:\n\n")
975      "XEmacs comes with plenty of documentation...\n\n"
976      ,@(if (string-match "beta" emacs-version)
977            `((key describe-beta)
978              ": " (face (red bold)
979                         "This is an Experimental version of XEmacs.\n"))
980          `( "\n"))
981      ((key xemacs-local-faq)
982       ": read the XEmacs FAQ (a " (face underline "capital") " F!)\n")
983      ((key help-with-tutorial)
984       ": read the XEmacs tutorial (also available through the "
985       (face bold "Help") " menu)\n")
986      ((key help-command)
987       ": get help on using XEmacs (also available through the "
988       (face bold "Help") " menu)\n")
989      ((key info) ": read the on-line documentation\n\n")
990      ((key describe-project) ": read about the GNU project\n")
991      ((key about-xemacs) ": see who's developing XEmacs\n"))
992
993     ((face (blue bold underline) "\nUseful stuff:\n\n")
994      "Things that you should know rather quickly...\n\n"
995      ((key find-file) ": visit a file\n")
996      ((key save-buffer) ": save changes\n")
997      ((key advertised-undo) ": undo changes\n")
998      ((key save-buffers-kill-emacs) ": exit XEmacs\n"))
999     ])
1000
1001 ;; I really hate global variables, oh well.
1002 ;(defvar xemacs-startup-logo-function nil
1003 ;  "If non-nil, function called to provide the startup logo.
1004 ;This function should return an initialized glyph if it is used.")
1005
1006 ;; This will hopefully go away when gettext is functional.
1007 (defconst splash-frame-static-body
1008   `(,(emacs-version) "\n\n"
1009     (face italic "`C-' means the control key,`M-' means the meta key\n\n")))
1010
1011
1012 (defun circulate-splash-frame-elements (client-data)
1013   (with-current-buffer (aref client-data 2)
1014     (let ((buffer-read-only nil)
1015           (elements (aref client-data 3))
1016           (indice (aref client-data 0)))
1017       (goto-char (aref client-data 1))
1018       (delete-region (point) (point-max))
1019       (splash-frame-present (aref elements indice))
1020       (set-buffer-modified-p nil)
1021       (aset client-data 0
1022             (if (= indice (- (length elements) 1))
1023                 0
1024               (1+ indice )))
1025       )))
1026
1027 ;; ### This function now returns the (possibly nil) timeout circulating the
1028 ;; splash-frame elements
1029 (defun display-splash-frame ()
1030   (let ((logo xemacs-logo)
1031         (buffer-read-only nil)
1032         (cramped-p (eq 'tty (console-type))))
1033     (unless cramped-p (insert "\n"))
1034     (indent-to (startup-center-spaces logo))
1035     (set-extent-begin-glyph (make-extent (point) (point)) logo)
1036     ;;(splash-frame-present-hack (make-extent p (point)) 'about-xemacs))
1037     (insert "\n\n")
1038     (splash-frame-present splash-frame-static-body)
1039     (splash-hack-version-string)
1040     (goto-char (point-max))
1041     (let* ((after-change-functions nil) ; no font-lock, thank you
1042            (elements (splash-frame-body))
1043            (client-data `[ 1 ,(point) ,(current-buffer) ,elements ])
1044            tmout)
1045       (if (listp  elements) ;; A single element to display
1046           (splash-frame-present (splash-frame-body))
1047         ;; several elements to rotate
1048         (splash-frame-present (aref elements 0))
1049         (setq tmout (add-timeout splash-frame-timeout
1050                                  'circulate-splash-frame-elements
1051                                  client-data splash-frame-timeout)))
1052       (set-buffer-modified-p nil)
1053       tmout)))
1054
1055 ;;  (let ((present-file
1056 ;;         #'(lambda (f)
1057 ;;             (splash-frame-present
1058 ;;            (list 'funcall
1059 ;;                  (list 'find-file-other-window
1060 ;;                        (expand-file-name f data-directory))
1061 ;;                  f)))))
1062 ;;    (insert "For customization examples, see the files ")
1063 ;;    (funcall present-file "sample.emacs")
1064 ;;    (insert " and ")
1065 ;;    (funcall present-file "sample.Xdefaults")
1066 ;;    (insert (format "\nin the directory %s." data-directory)))
1067
1068 (defun startup-set-invocation-environment ()
1069   ;; XEmacs -- Steven Baur says invocation directory is nil if you
1070   ;; try to use XEmacs as a login shell.
1071   (or invocation-directory (setq invocation-directory default-directory))
1072   (setq invocation-directory
1073         ;; don't let /tmp_mnt/... get into the load-path or exec-path.
1074         (abbreviate-file-name invocation-directory)))
1075
1076 (defun startup-setup-paths (roots user-init-directory
1077                                   &optional
1078                                   inhibit-early-packages inhibit-site-lisp
1079                                   debug-paths)
1080   "Setup all the various paths.
1081 ROOTS is a list of plausible roots of the XEmacs directory hierarchy.
1082 If INHIBIT-PACKAGES is non-NIL, don't do packages.
1083 If INHIBIT-SITE-LISP is non-NIL, don't do site-lisp.
1084 If DEBUG-PATHS is non-NIL, print paths as they are detected.
1085 It's idempotent, so call this as often as you like!"
1086
1087   (apply #'(lambda (early late last)
1088              (setq early-packages (and (not inhibit-early-packages)
1089                                        early))
1090              (setq late-packages late)
1091              (setq last-packages last))
1092          (packages-find-packages
1093           roots
1094           (packages-compute-package-locations user-init-directory)))
1095
1096   (setq early-package-load-path (packages-find-package-load-path early-packages))
1097   (setq late-package-load-path (packages-find-package-load-path late-packages))
1098   (setq last-package-load-path (packages-find-package-load-path last-packages))
1099
1100   (if debug-paths
1101       (progn
1102         (princ (format "configure-package-path:\n%S\n" configure-package-path)
1103                'external-debugging-output)
1104         (princ (format "early-packages and early-package-load-path:\n%S\n%S\n"
1105                        early-packages early-package-load-path)
1106                'external-debugging-output)
1107         (princ (format "late-packages and late-package-load-path:\n%S\n%S\n"
1108                        late-packages late-package-load-path)
1109                'external-debugging-output)
1110         (princ (format "last-packages and last-package-load-path:\n%S\n%S\n"
1111                        last-packages last-package-load-path)
1112                'external-debugging-output)))
1113
1114   (setq lisp-directory (paths-find-lisp-directory roots))
1115
1116   (if debug-paths
1117       (princ (format "lisp-directory:\n%S\n" lisp-directory)
1118              'external-debugging-output))
1119
1120   (setq site-directory (and (null inhibit-site-lisp)
1121                             (paths-find-site-lisp-directory roots)))
1122
1123   (if (and debug-paths (null inhibit-site-lisp))
1124       (princ (format "site-directory:\n%S\n" site-directory)
1125              'external-debugging-output))
1126
1127   (setq load-path (paths-construct-load-path roots
1128                                              early-package-load-path
1129                                              late-package-load-path
1130                                              last-package-load-path
1131                                              lisp-directory
1132                                              site-directory))
1133
1134   (setq Info-directory-list
1135         (paths-construct-info-path roots
1136                                    early-packages late-packages last-packages))
1137
1138
1139   (if debug-paths
1140       (princ (format "Info-directory-list:\n%S\n" Info-directory-list)
1141              'external-debugging-output))
1142
1143   (if (boundp 'lock-directory)
1144       (progn
1145         (setq lock-directory (paths-find-lock-directory roots))
1146         (setq superlock-file (paths-find-superlock-file lock-directory))
1147
1148         (if debug-paths
1149             (progn
1150               (princ (format "lock-directory:\n%S\n" lock-directory)
1151                      'external-debugging-output)
1152               (princ (format "superlock-file:\n%S\n" superlock-file)
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 ((lock (if (boundp 'lock-directory) lock-directory 't))
1203         (warnings '()))
1204     (if (and (stringp lock) (null (file-directory-p lock)))
1205         (setq lock nil))
1206     (cond
1207      ((null (and lisp-directory exec-directory data-directory doc-directory
1208                  load-path
1209                  lock))
1210       (save-excursion
1211         (set-buffer (get-buffer-create " *warning-tmp*"))
1212         (erase-buffer)
1213         (buffer-disable-undo (current-buffer))
1214         (if (null lisp-directory) (push "lisp-directory" warnings))
1215         (if (null lock)           (push "lock-directory" warnings))
1216         (if (null exec-directory) (push "exec-directory" warnings))
1217         (if (null data-directory) (push "data-directory" warnings))
1218         (if (null doc-directory)  (push "doc-directory"  warnings))
1219         (if (null load-path)      (push "load-path"      warnings))
1220
1221         (insert "Couldn't find obvious defaults for:\n")
1222         (while warnings
1223           (insert (car warnings) "\n")
1224           (setq warnings (cdr warnings)))
1225         (insert "Perhaps some directories don't exist, "
1226                 "or the XEmacs executable,\n" (concat invocation-directory
1227                                                      invocation-name)
1228                 "\nis in a strange place?")
1229
1230         (princ "\nWARNING:\n" 'external-debugging-output)
1231         (princ (buffer-string) 'external-debugging-output)
1232         (erase-buffer)
1233         t)))))
1234
1235 ;;; startup.el ends here