annotate lisp/startup.el @ 826:6728e641994e

[xemacs-hg @ 2002-05-05 11:30:15 by ben] syntax cache, 8-bit-format, lots of code cleanup README.packages: Update info about --package-path. i.c: Create an inheritable event and pass it on to XEmacs, so that ^C can be handled properly. Intercept ^C and signal the event. "Stop Build" in VC++ now works. bytecomp-runtime.el: Doc string changes. compat.el: Some attempts to redo this to make it truly useful and fix the "multiple versions interacting with each other" problem. Not yet done. Currently doesn't work. files.el: Use with-obsolete-variable to avoid warnings in new revert-buffer code. xemacs.mak: Split up CFLAGS into a version without flags specifying the C library. The problem seems to be that minitar depends on zlib, which depends specifically on libc.lib, not on any of the other C libraries. Unless you compile with libc.lib, you get errors -- specifically, no _errno in the other libraries, which must make it something other than an int. (#### But this doesn't seem to obtain in XEmacs, which also uses zlib, and can be linked with any of the C libraries. Maybe zlib is used differently and doesn't need errno, or maybe XEmacs provides an int errno; ... I don't understand. Makefile.in.in: Fix so that packages are around when testing. abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, callint.c, casefiddle.c, casetab.c, casetab.h, charset.h, chartab.c, chartab.h, cmds.c, console-msw.h, console-stream.c, console-x.c, console.c, console.h, data.c, device-msw.c, device.c, device.h, dialog-msw.c, dialog-x.c, dired-msw.c, dired.c, doc.c, doprnt.c, dumper.c, editfns.c, elhash.c, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, events.h, extents.c, extents.h, faces.c, file-coding.c, file-coding.h, fileio.c, fns.c, font-lock.c, frame-gtk.c, frame-msw.c, frame-x.c, frame.c, frame.h, glade.c, glyphs-gtk.c, glyphs-msw.c, glyphs-msw.h, glyphs-x.c, glyphs.c, glyphs.h, gui-msw.c, gui-x.c, gui.h, gutter.h, hash.h, indent.c, insdel.c, intl-win32.c, intl.c, keymap.c, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, marker.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-ccl.c, mule-charset.c, mule-coding.c, mule-wnnfns.c, nas.c, objects-msw.c, objects-x.c, opaque.c, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, process.h, profile.c, rangetab.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-x.c, redisplay.c, redisplay.h, regex.c, regex.h, scrollbar-msw.c, search.c, select-x.c, specifier.c, specifier.h, symbols.c, symsinit.h, syntax.c, syntax.h, syswindows.h, tests.c, text.c, text.h, tooltalk.c, ui-byhand.c, ui-gtk.c, unicode.c, win32.c, window.c: Another big Ben patch. -- FUNCTIONALITY CHANGES: add partial support for 8-bit-fixed, 16-bit-fixed, and 32-bit-fixed formats. not quite done yet. (in particular, needs functions to actually convert the buffer.) NOTE: lots of changes to regex.c here. also, many new *_fmt() inline funs that take an Internal_Format argument. redo syntax cache code. make the cache per-buffer; keep the cache valid across calls to functions that use it. also keep it valid across insertions/deletions and extent changes, as much as is possible. eliminate the junky regex-reentrancy code by passing in the relevant lisp info to the regex routines as local vars. add general mechanism in extents code for signalling extent changes. fix numerous problems with the case-table implementation; yoshiki never properly transferred many algorithms from old-style to new-style case tables. redo char tables to support a default argument, so that mapping only occurs over changed args. change many chartab functions to accept Lisp_Object instead of Lisp_Char_Table *. comment out the code in font-lock.c by default, because font-lock.el no longer uses it. we should consider eliminating it entirely. Don't output bell as ^G in console-stream when not a TTY. add -mswindows-termination-handle to interface with i.c, so we can properly kill a build. add more error-checking to buffer/string macros. add some additional buffer_or_string_() funs. -- INTERFACE CHANGES AFFECTING MORE CODE: switch the arguments of write_c_string and friends to be consistent with write_fmt_string, which must have printcharfun first. change BI_* macros to BYTE_* for increased clarity; similarly for bi_* local vars. change VOID_TO_LISP to be a one-argument function. eliminate no-longer-needed CVOID_TO_LISP. -- char/string macro changes: rename MAKE_CHAR() to make_emchar() for slightly less confusion with make_char(). (The former generates an Emchar, the latter a Lisp object. Conceivably we should rename make_char() -> wrap_char() and similarly for make_int(), make_float().) Similar changes for other *CHAR* macros -- we now consistently use names with `emchar' whenever we are working with Emchars. Any remaining name with just `char' always refers to a Lisp object. rename macros with XSTRING_* to string_* except for those that reference actual fields in the Lisp_String object, following conventions used elsewhere. rename set_string_{data,length} macros (the only ones to work with a Lisp_String_* instead of a Lisp_Object) to set_lispstringp_* to make the difference clear. try to be consistent about caps vs. lowercase in macro/inline-fun names for chars and such, which wasn't the case before. we now reserve caps either for XFOO_ macros that reference object fields (e.g. XSTRING_DATA) or for things that have non-function semantics, e.g. directly modifying an arg (BREAKUP_EMCHAR) or evaluating an arg (any arg) more than once. otherwise, use lowercase. here is a summary of most of the macros/inline funs changed by all of the above changes: BYTE_*_P -> byte_*_p XSTRING_BYTE -> string_byte set_string_data/length -> set_lispstringp_data/length XSTRING_CHAR_LENGTH -> string_char_length XSTRING_CHAR -> string_emchar INTBYTE_FIRST_BYTE_P -> intbyte_first_byte_p INTBYTE_LEADING_BYTE_P -> intbyte_leading_byte_p charptr_copy_char -> charptr_copy_emchar LEADING_BYTE_* -> leading_byte_* CHAR_* -> EMCHAR_* *_CHAR_* -> *_EMCHAR_* *_CHAR -> *_EMCHAR CHARSET_BY_ -> charset_by_* BYTE_SHIFT_JIS* -> byte_shift_jis* BYTE_BIG5* -> byte_big5* REP_BYTES_BY_FIRST_BYTE -> rep_bytes_by_first_byte char_to_unicode -> emchar_to_unicode valid_char_p -> valid_emchar_p Change intbyte_strcmp -> qxestrcmp_c (duplicated functionality). -- INTERFACE CHANGES AFFECTING LESS CODE: use DECLARE_INLINE_HEADER in various places. remove '#ifdef emacs' from XEmacs-only files. eliminate CHAR_TABLE_VALUE(), which duplicated the functionality of get_char_table(). add BUFFER_TEXT_LOOP to simplify iterations over buffer text. define typedefs for signed and unsigned types of fixed sizes (INT_32_BIT, UINT_32_BIT, etc.). create ALIGN_FOR_TYPE as a higher-level interface onto ALIGN_SIZE; fix code to use it. add charptr_emchar_len to return the text length of the character pointed to by a ptr; use it in place of charcount_to_bytecount(..., 1). add emchar_len to return the text length of a given character. add types Bytexpos and Charxpos to generalize Bytebpos/Bytecount and Charbpos/Charcount, in code (particularly, the extents code and redisplay code) that works with either kind of index. rename redisplay struct params with names such as `charbpos' to e.g. `charpos' when they are e.g. a Charxpos, not a Charbpos. eliminate xxDEFUN in place of DEFUN; no longer necessary with changes awhile back to doc.c. split up big ugly combined list of EXFUNs in lisp.h on a file-by-file basis, since other prototypes are similarly split. rewrite some "*_UNSAFE" macros as inline funs and eliminate the _UNSAFE suffix. move most string code from lisp.h to text.h; the string code and text.h code is now intertwined in such a fashion that they need to be in the same place and partially interleaved. (you can't create forward references for inline funs) automated/lisp-tests.el, automated/symbol-tests.el, automated/test-harness.el: Fix test harness to output FAIL messages to stderr when in batch mode. Fix up some problems in lisp-tests/symbol-tests that were causing spurious failures.
author ben
date Sun, 05 May 2002 11:33:57 +0000
parents 7778a469a8ac
children 42375619fa45
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 ;;; startup.el --- process XEmacs shell arguments
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 ;; Copyright (C) 1985-1986, 1990, 1992-1997 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 ;; Copyright (c) 1993, 1994 Sun Microsystems, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 ;; Copyright (C) 1995 Board of Trustees, University of Illinois
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
6 ;; Copyright (C) 2001, 2002 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 ;; Maintainer: XEmacs Development Team
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 ;; Keywords: internal, dumped
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 ;; This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ;; XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 ;; under the terms of the GNU General Public License as published by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 ;; the Free Software Foundation; either version 2, or (at your option)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 ;; any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 ;; XEmacs is distributed in the hope that it will be useful, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 ;; General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
24 ;; along with XEmacs; see the file COPYING. If not, write to the
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 ;; Free Software Foundation, 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 ;; Boston, MA 02111-1307, USA.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 ;;; Synched up with: FSF 19.34.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 ;;; Commentary:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 ;; This file is dumped with XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
34 ;; It handles the all aspects of startup once the C code has finished
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
35 ;; initializing itself. Entry from C is through the function set in
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
36 ;; the `top-level' variable, which is normally `normal-top-level'. At
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
37 ;; the point that `normal-top-level' has been invoked:
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
38 ;;
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
39 ;; (1) the dumped Elisp files are available. Either they were loaded
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
40 ;; during this invocation of temacs and it was then converted to
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
41 ;; XEmacs using the run-temacs mechanism, or (more likely) the
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
42 ;; loadup and dumping occurred at some point in the past and we
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
43 ;; just read in the dumped data.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
44 ;;
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
45 ;; (2) All C subsystems have been initialized.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
46 ;;
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
47 ;; (3) A "stream" device has been created, which does I/O over stdin
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
48 ;; and stdout. This is the only device we have available and our
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
49 ;; only means of communication, other than disk files.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
50 ;;
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
51 ;; (4) The command-line arguments have been sorted according to
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
52 ;; priority specs (this implies that the names of all arguments
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
53 ;; must be hard-coded into emacs.c), and certain low-level
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
54 ;; arguments such as -sd, -t, -nd, -nw, -batch, etc. have been
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
55 ;; processed by main_1() and removed. (NOTE: main_1() is the name
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
56 ;; in the source code, but in the object file it has some other
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
57 ;; name, such as xemacs_21_2_34_mips_sgi_irix6().) Certain other
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
58 ;; arguments such as -version and -help are partially-processed,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
59 ;; triggering some special behavior but being left on the list for
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
60 ;; further processing by the Lisp code.
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
61 ;;
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
62 ;; The job of the code here is to process the remaining command-line
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
63 ;; args, set up the various paths, locate where all the packages are
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
64 ;; and set things up for them (initialize the load path, read in the
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
65 ;; autoloads, etc.), read in the init files, display the splash
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
66 ;; screen, and set up any remaining environment-dependent variables.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 ;;; Code:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 (setq top-level '(normal-top-level))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 (defvar command-line-processed nil "t once command line has been processed")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 (defconst startup-message-timeout 12000) ; More or less disable the timeout
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 (defconst splash-frame-timeout 7) ; interval between splash frame elements
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 (defconst inhibit-startup-message nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 "*Non-nil inhibits the initial startup message.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 This is for use in your personal init file, once you are familiar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 with the contents of the startup message.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 ;; #### FSFmacs randomness
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 ;;(defconst inhibit-startup-echo-area-message nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 ;; "*Non-nil inhibits the initial startup echo area message.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 ;;Inhibition takes effect only if your `.emacs' file contains
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 ;;a line of this form:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 ;; (setq inhibit-startup-echo-area-message \"YOUR-USER-NAME\")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 ;;If your `.emacs' file is byte-compiled, use the following form instead:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 ;; (eval '(setq inhibit-startup-echo-area-message \"YOUR-USER-NAME\"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 ;;Thus, someone else using a copy of your `.emacs' file will see
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 ;;the startup message unless he personally acts to inhibit it.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 (defconst inhibit-default-init nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 "*Non-nil inhibits loading the `default' library.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 (defvar command-line-args-left nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 "List of command-line args not yet processed.") ; bound by `command-line'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 (defvar command-line-default-directory nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 "Default directory to use for command line arguments.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 This is normally copied from `default-directory' when XEmacs starts.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 (defvar before-init-hook nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 "Functions to call after handling urgent options but before init files.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 The frame system uses this to open frames to display messages while
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 XEmacs loads the user's initialization file.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 (defvar after-init-hook nil
452
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
109 "*Functions to call after loading the init file.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 The call is not protected by a condition-case, so you can set `debug-on-error'
452
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
111 in the init file, and put all the actual code on `after-init-hook'.")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 (defvar term-setup-hook nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 "*Functions to be called after loading terminal-specific Lisp code.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 See `run-hooks'. This variable exists for users to set, so as to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 override the definitions made by the terminal-specific file. XEmacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 never sets this variable itself.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 (defvar keyboard-type nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 "The brand of keyboard you are using.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 This variable is used to define the proper function and keypad keys
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 for use under X. It is used in a fashion analogous to the environment
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 value TERM.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 (defvar window-setup-hook nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 "Normal hook run to initialize window system display.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 XEmacs runs this hook after processing the command line arguments and loading
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 the user's init file.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 (defconst initial-major-mode 'lisp-interaction-mode
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 "Major mode command symbol to use for the initial *scratch* buffer.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 (defvar emacs-roots nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 "List of plausible roots of the XEmacs hierarchy.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 (defvar user-init-directory-base ".xemacs"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 "Base of directory where user-installed init files may go.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 (defvar user-init-directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 (file-name-as-directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 (paths-construct-path (list "~" user-init-directory-base)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 "Directory where user-installed init files may go.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
144 (defvar user-init-file-base "init.el"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
145 "Default name of the user init file if uncompiled.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
146 This should be used for migration purposes only.")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
147
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
148 (defvar user-init-file-base-list '("init.elc" "init.el")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
149 "List of allowed init files in the user's init directory.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
150 The first one found takes precedence.")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
151
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
152 (defvar user-home-init-file-base-list
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
153 (append '(".emacs.elc" ".emacs.el" ".emacs")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
154 (and (eq system-type 'windows-nt)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
155 '("_emacs.elc" "_emacs.el" "_emacs")))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
156 "List of allowed init files in the user's home directory.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
157 The first one found takes precedence.")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
158
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
159 (defvar load-home-init-file nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
160 "Non-nil if XEmacs should load the init file from the home directory.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
161 Otherwise, XEmacs will offer migration to the init directory.")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
162
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 (defvar load-user-init-file-p t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 "Non-nil if XEmacs should load the user's init file.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 ;; #### called `site-run-file' in FSFmacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
168 (defvar site-start-file "site-start"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 "File containing site-wide run-time initializations.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 This file is loaded at run-time before `.emacs'. It
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 contains inits that need to be in place for the entire site, but
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 which, due to their higher incidence of change, don't make sense to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 load into XEmacs' dumped image. Thus, the run-time load order is:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 1. file described in this variable, if non-nil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 2. `.emacs';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 3. `/path/to/xemacs/lisp/default.el'.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 Don't use the `site-start.el' file for things some users may not like.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 Put them in `default.el' instead, so that users can more easily
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 override them. Users can prevent loading `default.el' with the `-q'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 option or by setting `inhibit-default-init' in their own init files,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 but inhibiting `site-start.el' requires `--no-site-file', which
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 is less convenient.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 ;;(defconst iso-8859-1-locale-regexp "8859[-_]?1"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 ;; "Regexp that specifies when to enable the ISO 8859-1 character set.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 ;;We do that if this regexp matches the locale name
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 ;;specified by the LC_ALL, LC_CTYPE and LANG environment variables.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
191 (defcustom mail-host-address nil
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
192 "*Name of this machine, for purposes of naming users."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
193 :type 'string
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
194 :group 'mail)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
196 (defcustom user-mail-address nil
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 "*Full mailing address of this user.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 This is initialized based on `mail-host-address',
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
199 after your init file is read, in case it sets `mail-host-address'."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
200 :type 'string
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
201 :group 'mail)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 (defvar init-file-debug nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 (defvar init-file-had-error nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 (defvar init-file-loaded nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 "True after the user's init file has been loaded (or suppressed with -q).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 This will be true when `after-init-hook' is run and at all times
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 after, and will not be true at any time before.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 (defvar initial-frame-unmapped-p nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 (defvar command-switch-alist
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
217 '(("-help" . command-line-do-help)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
218 ("-version" . command-line-do-version)
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
219 ("-V" . command-line-do-version)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
220 ("-funcall" . command-line-do-funcall)
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
221 ("-f" . command-line-do-funcall)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
222 ("-e" . command-line-do-funcall-1)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
223 ("-eval" . command-line-do-eval)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
224 ("-load" . command-line-do-load)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
225 ("-l" . command-line-do-load)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
226 ("-insert" . command-line-do-insert)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
227 ("-i" . command-line-do-insert)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
228 ("-kill" . command-line-do-kill)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
229 ("-eol" . command-line-do-enable-eol-detection)
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
230 ("-enable-eol-detection" . command-line-do-enable-eol-detection)
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
231 ;; Options like +35 are handled specially.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
232 ;; Window-system, site, or package-specific code might add to this.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
233 ;; X11 handles its options by letting Xt remove args from this list.
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
234 )
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 "Alist of command-line switches.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 Elements look like (SWITCH-STRING . HANDLER-FUNCTION).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 HANDLER-FUNCTION receives switch name as sole arg;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 remaining command-line args are in the variable `command-line-args-left'.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 ;;; default switches
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 ;;; Note: these doc strings are semi-magical.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 (defun command-line-do-help (arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 "Print the XEmacs usage message and exit."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 (let ((standard-output 'external-debugging-output))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 (princ (concat "\n" (emacs-version) "\n\n"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 (princ
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 (if (featurep 'x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 (concat "When creating a window on an X display, "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 (emacs-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 " accepts all standard X Toolkit
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 command line options plus the following:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 -iconname <title> Use title as the icon name.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 -mc <color> Use color as the mouse color.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 -cr <color> Use color as the text-cursor foregound color.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 -private Install a private colormap.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 In addition, the")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 "The"))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
260 (let ((l command-switch-alist)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
261 (options " following options are accepted:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
262
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
263 Display options:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
264
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
265 -nw Open the initial frame on the current TTY, instead of
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
266 a window system.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
267 -t <device> Use TTY <device> instead of the current TTY for input
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
268 and output. This implies the -nw option.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
269 -display <display> Standard X option, to specify the display connection.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
270 If this option is given, or if the environment
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
271 variable DISPLAY is set, an initial X frame will be
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
272 created. Otherwise, an initial Windows frame will be
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
273 created if Windows support exists and neither -nw nor
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
274 -t is given. Otherwise, a TTY frame is created.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
275 -unmapped Do not display the initial frame. Useful to create
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
276 a \"server\" that can accept `gnuclient' connections.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
277
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
278 Noninteractive options:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
279
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
280 {-help}
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
281 {-version}
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
282 {-V}
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
283 -batch Execute noninteractively (messages go to stderr, no
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
284 initial frame created).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
285 {-funcall}
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
286 (The function may parse the rest of the command line
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
287 for its arguments.)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
288 {-f}
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
289 {-eval}
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
290 {-load}
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
291 {-l}
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
292 {-insert}
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
293 {-i}
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
294 {-kill}
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
295 -sd Show dump ID. Ignored when configured without --pdump.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
296 -nd Don't load the dump file. Roughly like old temacs.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 444
diff changeset
297 Ignored when configured without --pdump.
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
298
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
299 Initialization files:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
300
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
301 -no-init-file Do not load the user-specific init file.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
302 -q Same as -no-init-file.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 -debug-init Enter the debugger if an error in the init file occurs.
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
304 -user-init-file <file>
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
305 Use <file> as init file.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
306 -user-init-directory <directory>
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
307 Use <directory> as init directory.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
308 -user <user> Load user's init file instead of your own.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
309 -u <user> Same as -user.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
310 -no-site-file Do not load the site-specific init file
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
311 (site-start.el).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
312
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
313 Package/module options:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
314
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
315 -vanilla Equivalent to -q -no-site-file -no-early-packages.
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
316 Useful if you think some user-init or site-init code
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
317 is messing things up, or when running XEmacs in
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
318 batch mode.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 -no-autoloads Do not load global symbol files (auto-autoloads) at
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 startup. Also implies `-vanilla'.
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
321 -no-packages Pretend like the packages don't exist. Don't put
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
322 any packages in the load path or set up any package
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
323 autoloads. Also Implies `-vanilla'. Use this when
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
324 running XEmacs in batch mode when you aren't using
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
325 any functionality in packages and want to make sure
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
326 that you get no interference from packages
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
327 (e.g. Lisp files that shadow core Lisp files).
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
328 -no-early-packages Do not process early packages.
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
329 -debug-paths Display info about the runtime values of various
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
330 directory variables (e.g. for loading packages).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
331 -no-site-modules Do not search site-modules directories for modules
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
332 at startup. Only applies when modules support is
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
333 compiled into XEmacs.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
334
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
335 Encoding options:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
336
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
337 -eol Turn on EOL detection (only applies to Unix, no
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
338 international support; otherwise EOL detection is
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
339 already on).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
340 -nuni Under MS Windows, disable use of the Unicode versions
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
341 of API calls. Not for Windows 95/98/ME. This is
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
342 mostly only useful for debugging purposes.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
343
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
344 Misc:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
345
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
346 +N <file> Start displaying <file> at line N.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
347 ")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 (insert (lambda (&rest x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 (let ((len 2))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 (while x
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 (princ (car x))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 (incf len (length (car x)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 (setq x (cdr x)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 (when (>= len 24)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 (terpri) (setq len 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 (while (< len 24)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 (princ " ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 (incf len))))))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
359 (princ
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
360 (with-temp-buffer
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
361 (insert options)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
362 (while l
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
363 (let ((name (car (car l)))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
364 (fn (cdr (car l)))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
365 doc arg cons)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
366 (cond
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
367 ((and (symbolp fn) (get fn 'undocumented)) nil)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
368 (t
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
369 (setq doc (documentation fn))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
370 (if (member doc '(nil "")) (setq doc "(undocumented)"))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
371 (cond ((string-match "\n\\(<.*>\\)\n?\\'" doc)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
372 ;; Doc of the form "The frobber switch\n<arg1> <arg2>"
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
373 (setq arg (substring doc (match-beginning 1) (match-end 1))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
374 doc (substring doc 0 (match-beginning 0))))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
375 ((string-match "\n+\\'" doc)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
376 (setq doc (substring doc 0 (match-beginning 0)))))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
377 (if (and (setq cons (rassq fn command-switch-alist))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
378 (not (eq cons (car l))))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
379 (setq doc (format "Same as %s." (car cons))))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
380 (goto-char (point-min))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
381 (when (search-forward (format "{%s}" name) nil t)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
382 (delete-region (match-beginning 0) (match-end 0))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
383 (let ((standard-output (current-buffer)))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
384 (if arg
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
385 (funcall insert name " " arg)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
386 (funcall insert name))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
387 (princ doc))))))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
388 (setq l (cdr l)))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
389 (buffer-string))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 (princ (concat "\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 Anything else is considered a file name, and is placed into a buffer for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 editing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 " (emacs-name) " has an online tutorial and manuals. Type ^Ht (Control-h t) after
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 starting XEmacs to run the tutorial. Type ^Hi to enter the manual browser.
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
397 Type ^H^H^H (Control-h Control-h Control-h) to get more help options.\n"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
399 (kill-emacs 0)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
400 ))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 (defun command-line-do-funcall (arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 "Invoke the named lisp function with no arguments.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 <function>"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 (funcall (intern (pop command-line-args-left))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 (fset 'command-line-do-funcall-1 'command-line-do-funcall)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 (put 'command-line-do-funcall-1 'undocumented t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 (defun command-line-do-eval (arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 "Evaluate the lisp form. Quote it carefully.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 <form>"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 (eval (read (pop command-line-args-left))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 (defun command-line-do-load (arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 "Load the named file of Lisp code into XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 <file>"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 (let ((file (pop command-line-args-left)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 ;; Take file from default dir if it exists there;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 ;; otherwise let `load' search for it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 (if (file-exists-p (expand-file-name file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 (setq file (expand-file-name file)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 (load file nil t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 (defun command-line-do-insert (arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 "Insert file into the current buffer.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 <file>"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 (insert-file-contents (pop command-line-args-left)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 (defun command-line-do-kill (arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 "Exit XEmacs."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 (kill-emacs t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 (defun command-line-do-version (arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 "Print version info and exit."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 (princ (concat (emacs-version) "\n"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 (kill-emacs 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
438 (defun command-line-do-enable-eol-detection (arg)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
439 "Turn on EOL detection (only applies to Unix)."
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
440 (set-eol-detection t))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
441
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 ;;; Processing the command line and loading various init files
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 (defun early-error-handler (&rest debugger-args)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 "You should probably not be using this."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 ;; Used as the debugger during XEmacs initialization; if an error occurs,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 ;; print some diagnostics, and kill XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 ;; output the contents of the warning buffer, since it won't be seen
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 ;; otherwise.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 ;; #### kludge! The call to Feval forces the pending warnings to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 ;; get output. There definitely needs to be a better way.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 (let ((buffer (eval (get-buffer-create "*Warnings*"))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 (princ (buffer-substring (point-min buffer) (point-max buffer) buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 'external-debugging-output))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 (let ((string "Initialization error")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 (error (nth 1 debugger-args))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 (debug-on-error nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 (stream 'external-debugging-output))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 (if (null error)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 (princ string stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 (princ (concat "\n" string ": ") stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 (condition-case ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 (display-error error stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 (error (princ "<<< error printing error message >>>" stream)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 (princ "\n" stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 (if (memq (car-safe error) '(void-function void-variable))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 (princ "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 This probably means that XEmacs is picking up an old version of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 the lisp library, or that some .elc files are not up-to-date.\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 stream)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 (when (not suppress-early-error-handler-backtrace)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 (let ((print-length 1000)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 (print-level 1000)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 (print-escape-newlines t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 (print-readably nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 (when (getenv "EMACSLOADPATH")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 (princ (format "\n$EMACSLOADPATH is %s" (getenv "EMACSLOADPATH"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 stream))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 (princ (format "\nexec-directory is %S" exec-directory) stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 (princ (format "\ndata-directory is %S" data-directory) stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 (princ (format "\ndata-directory-list is %S" data-directory-list) stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 (princ (format "\ndoc-directory is %S" doc-directory) stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 (princ (format "\nload-path is %S" load-path) stream)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 (princ "\n\n" stream)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 (when (not suppress-early-error-handler-backtrace)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 (backtrace stream t)))
778
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 776
diff changeset
490 (if-fboundp 'mswindows-message-box
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
491 (mswindows-message-box "Initialization error"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 (kill-emacs -1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 (defun normal-top-level ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 (if command-line-processed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 (message "Back to top level.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 (setq command-line-processed t)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
498 ;; Do this first for maximum likelihood of catching errors. The main
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
499 ;; purpose of this is so that debug-on-error can be set to catch errors
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
500 ;; during normal noninteractive running.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
501 (when (getenv "XEMACSDEBUG")
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
502 (eval (read (getenv "XEMACSDEBUG"))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 ;; Canonicalize HOME (PWD is canonicalized by init_buffer in buffer.c)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 (let ((value (user-home-directory)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 (if (and value
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 (< (length value) (length default-directory))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 (equal (file-attributes default-directory)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 (file-attributes value)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 (setq default-directory (file-name-as-directory value))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 (setq default-directory (abbreviate-file-name default-directory))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 (initialize-xemacs-paths)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 (startup-set-invocation-environment)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 (let ((debug-paths (or debug-paths
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 (and (getenv "EMACSDEBUGPATHS")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 t))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 (setq emacs-roots (paths-find-emacs-roots invocation-directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 invocation-name))
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
521
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 (if debug-paths
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 (princ (format "emacs-roots:\n%S\n" emacs-roots)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 'external-debugging-output))
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
525
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 (if (null emacs-roots)
458
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
527 (startup-find-roots-warning))
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
528 (startup-setup-paths emacs-roots
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
529 user-init-directory
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
530 (cond (inhibit-all-packages t)
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
531 (inhibit-early-packages '(early))
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
532 (t nil))
458
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 452
diff changeset
533 inhibit-site-lisp
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
534 debug-paths
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
535 nil)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 (startup-setup-paths-warning))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 502
diff changeset
538 (startup-load-autoloads)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 (unwind-protect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 (command-line)
452
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
542 ;; Do this again, in case the init file defined more abbreviations.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 (setq default-directory (abbreviate-file-name default-directory))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 ;; Specify the file for recording all the auto save files of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 ;; this session. This is used by recover-session.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
546 (if auto-save-list-file-prefix
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
547 (setq auto-save-list-file-name
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
548 (expand-file-name
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
549 (format "%s%d-%s"
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
550 auto-save-list-file-prefix
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
551 (emacs-pid)
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
552 (system-name)))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 (run-hooks 'emacs-startup-hook)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 (and term-setup-hook
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 (run-hooks 'term-setup-hook))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 (setq term-setup-hook nil)
452
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
557 ;; ;; Modify the initial frame based on what the init file puts into
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 ;; ;; ...-frame-alist.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 (frame-notice-user-settings)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560 ;; ;;####FSFmacs junk
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 ;; ;; Now we know the user's default font, so add it to the menu.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562 ;; (if (fboundp 'font-menu-add-default)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 ;; (font-menu-add-default))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 (when window-setup-hook
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 (run-hooks 'window-setup-hook))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 (setq window-setup-hook nil))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
567
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
568 (if load-user-init-file-p
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
569 (maybe-migrate-user-init-file))
611
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 528
diff changeset
570 ;; FSF calls precompute-menubar-bindings. We don't mix menubars
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 528
diff changeset
571 ;; and keymaps.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 ))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574 (defun command-line-early (args)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 ;; This processes those switches which need to be processed before
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 ;; starting up the window system.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 (setq command-line-default-directory default-directory)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580 ;; See if we should import version-control from the environment variable.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 (let ((vc (getenv "VERSION_CONTROL")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582 (cond ((eq vc nil)) ;don't do anything if not set
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 ((or (string= vc "t")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 (string= vc "numbered"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 (setq version-control t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 ((or (string= vc "nil")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587 (string= vc "existing"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 (setq version-control nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 ((or (string= vc "never")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 (string= vc "simple"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 (setq version-control 'never))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 ;;####FSFmacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 ;; (if (let ((ctype
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 ;; ;; Use the first of these three envvars that has a nonempty value.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 ;; (or (let ((string (getenv "LC_ALL")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 ;; (and (not (equal string "")) string))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 ;; (let ((string (getenv "LC_CTYPE")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 ;; (and (not (equal string "")) string))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 ;; (let ((string (getenv "LANG")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 ;; (and (not (equal string "")) string)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 ;; (and ctype
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 ;; (string-match iso-8859-1-locale-regexp ctype)))
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
604 ;; (progn
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 ;; (standard-display-european t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 ;; (require 'iso-syntax)))
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
607
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
608 (if vanilla-inhibiting ;; set in main_1()
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
609 (setq load-user-init-file-p nil
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
610 site-start-file nil)
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
611 (setq load-user-init-file-p (not (noninteractive))))
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
612
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613 ;; Allow (at least) these arguments anywhere in the command line
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
614 (macrolet ((long-argmatch (match)
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
615 ;; use a macro to avoid lots of concatting at runtime
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
616 `(or (string= arg ,match)
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
617 (string= arg ,(concat "-" match)))))
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
618 (let ((new-args nil)
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
619 (arg nil))
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
620 (while args
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
621 (setq arg (pop args))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622 (cond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623 ((or (string= arg "-q")
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
624 (long-argmatch "-no-init-file"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 (setq load-user-init-file-p nil))
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
626 ((long-argmatch "-no-site-file")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627 (setq site-start-file nil))
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
628 ((long-argmatch "-user-init-file")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629 (setq user-init-file (pop args)))
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
630 ((long-argmatch "-user-init-directory")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631 (setq user-init-directory (file-name-as-directory (pop args))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 ((or (string= arg "-u")
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
633 (long-argmatch "-user"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 (let* ((user (pop args))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635 (home-user (concat "~" user)))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
636 (setq user-init-directory (file-name-as-directory
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
637 (paths-construct-path
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
638 (list home-user user-init-directory-base))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
639 (setq user-init-file
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
640 (find-user-init-file user-init-directory home-user))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
641 (setq custom-file
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
642 (make-custom-file-name user-init-file))))
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
643 ((long-argmatch "-debug-init")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 (setq init-file-debug t))
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
645 ((long-argmatch "-unmapped")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 (setq initial-frame-unmapped-p t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647 ((or (string= arg "--") (string= arg "-"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648 (while args
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649 (push (pop args) new-args)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
650 (t (push arg new-args))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
652 (with-obsolete-variable 'init-file-user
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
653 (setq init-file-user (and load-user-init-file-p "")))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
655 (nreverse new-args))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
656
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
657 (defconst initial-scratch-message "\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
658 ;; This buffer is for notes you don't want to save, and for Lisp evaluation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 ;; If you want to create a file, first visit that file with C-x C-f,
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
660 ;; then enter the text in that file's own buffer. (C-x is the standard
684
c6ad4a798ab9 [xemacs-hg @ 2001-12-03 06:49:11 by youngs]
youngs
parents: 611
diff changeset
661 ;; XEmacs abbreviation for `Control+x', i.e. hold down the Control key
c6ad4a798ab9 [xemacs-hg @ 2001-12-03 06:49:11 by youngs]
youngs
parents: 611
diff changeset
662 ;; while hitting the x key.)
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
663 ;;
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 487
diff changeset
664 ;; For Lisp evaluation, type an expression, move to the end and hit C-j.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666 "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667 "Initial message displayed in *scratch* buffer at startup.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
668 If this is nil, no message will be displayed.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
669
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670 (defun command-line ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671 (let ((command-line-args-left (cdr command-line-args)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673 (let ((debugger 'early-error-handler)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
674 (debug-on-error t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
675
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
676 ;; Process magic command-line switches like -q and -u. Do this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
677 ;; before creating the first frame because some of these switches
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678 ;; may affect that. I think it's ok to do this before establishing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679 ;; the X connection, and maybe someday things like -nw can be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
680 ;; handled here instead of down in C.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 (setq command-line-args-left (command-line-early command-line-args-left))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682
611
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 528
diff changeset
683 (when (eq system-type 'windows-nt)
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
684 (declare-fboundp (init-mswindows-at-startup)))
611
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 528
diff changeset
685
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
686 ;; Setup the toolbar icon directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687 (when (featurep 'toolbar)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
688 (init-toolbar-location))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
689
487
54fa1a5c2d12 [xemacs-hg @ 2001-04-28 07:48:36 by ben]
ben
parents: 470
diff changeset
690 (if (featurep 'toolbar)
54fa1a5c2d12 [xemacs-hg @ 2001-04-28 07:48:36 by ben]
ben
parents: 470
diff changeset
691 (if (featurep 'infodock)
54fa1a5c2d12 [xemacs-hg @ 2001-04-28 07:48:36 by ben]
ben
parents: 470
diff changeset
692 (require 'id-x-toolbar)
54fa1a5c2d12 [xemacs-hg @ 2001-04-28 07:48:36 by ben]
ben
parents: 470
diff changeset
693 (init-toolbar)))
54fa1a5c2d12 [xemacs-hg @ 2001-04-28 07:48:36 by ben]
ben
parents: 470
diff changeset
694
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
695 ;; Run the window system's init function. tty is considered to be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
696 ;; a type of window system for this purpose. This creates the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
697 ;; initial (non stdio) device.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
698 (when (and initial-window-system (not noninteractive))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
699 (funcall (intern (concat "init-"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
700 (symbol-name initial-window-system)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
701 "-win"))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
702
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
703 ;; When not in batch mode, this creates the first visible frame,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 ;; and deletes the stdio device.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
705 (frame-initialize))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
707 ;; Reinitialize faces if necessary. This function changes face if
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
708 ;; it is created during auto-autoloads loading. Otherwise, it
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
709 ;; does nothing.
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
710 (startup-initialize-custom-faces)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
711
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
712 ;; A couple of other things need to be initted.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
713 ;; (RMS writes about internally using hooks for this, in reference
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
714 ;; to frame-initialize and frame-notice-user-settings:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
715 ;;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
716 ;; These are now called explicitly at the proper times,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
717 ;; since that is easier to understand.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
718 ;; Actually using hooks within Emacs is bad for future maintenance. --rms.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
719 ;;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
720 ;; In this case, I completely agree. --ben
811
7778a469a8ac [xemacs-hg @ 2002-04-07 19:36:13 by wmperry]
wmperry
parents: 793
diff changeset
721 (if (featurep 'menubar)
7778a469a8ac [xemacs-hg @ 2002-04-07 19:36:13 by wmperry]
wmperry
parents: 793
diff changeset
722 (init-menubar-at-startup))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
723 ;; perhaps this should go earlier in the proecess?
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
724 (if (featurep 'mule)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
725 (declare-fboundp (init-mule-at-startup)))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
726
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
727 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
728 ;; We have normality, I repeat, we have normality. Anything you still
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
729 ;; can't cope with is therefore your own problem. (And we don't need
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
730 ;; to kill XEmacs for it.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
731 ;;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
732
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
733 ;;; Load init files.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
734 (load-init-file)
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
735
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736 (with-current-buffer (get-buffer "*scratch*")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
737 (erase-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
738 ;; (insert initial-scratch-message)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
739 (set-buffer-modified-p nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
740 (when (eq major-mode 'fundamental-mode)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
741 (funcall initial-major-mode)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
742
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
743 ;; Load library for our terminal type.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
744 ;; User init file can set term-file-prefix to nil to prevent this.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745 ;; Note that for any TTY's opened subsequently, the TTY init
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
746 ;; code will run this.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
747 (when (and (eq 'tty (console-type))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
748 (not (noninteractive)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
749 (load-terminal-library))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
750
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
751 ;; Process the remaining args.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
752 (command-line-1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
753
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
754 ;; it was turned on by default so that the warnings don't get displayed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
755 ;; until after the splash screen.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
756 (setq inhibit-warning-display nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
757 ;; If -batch, terminate after processing the command options.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
758 (when (noninteractive) (kill-emacs t))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
759
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
760 (defun load-terminal-library ()
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
761 (when term-file-prefix
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
762 (let ((term (getenv "TERM"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
763 hyphend)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
764 (while (and term
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
765 (not (load (concat term-file-prefix term) t t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
766 ;; Strip off last hyphen and what follows, then try again
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
767 (if (setq hyphend (string-match "[-_][^-_]+\\'" term))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
768 (setq term (substring term 0 hyphend))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
769 (setq term nil))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
770
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
771 (defun find-user-init-directory-init-file (&optional init-directory)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
772 "Determine the user's init file if in the init directory."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
773 (let ((init-directory (or init-directory user-init-directory)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
774 (catch 'found
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
775 (dolist (file user-init-file-base-list)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
776 (let ((expanded (expand-file-name file init-directory)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
777 (when (file-readable-p expanded)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
778 (throw 'found expanded)))))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
779
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
780 (defun find-user-home-directory-init-file (&optional home-directory)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
781 "Determine the user's init file if in the home directory."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
782 (let ((home-directory (or home-directory "~")))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
783 (catch 'found
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
784 (dolist (file user-home-init-file-base-list)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
785 (let ((expanded (expand-file-name file home-directory)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
786 (when (file-readable-p expanded)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
787 (throw 'found expanded))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
788 nil)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
789
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
790 (defun find-user-init-file (&optional init-directory home-directory)
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
791 "Determine the user's init file."
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
792 (if load-home-init-file
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
793 (find-user-home-directory-init-file home-directory)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
794 (or (find-user-init-directory-init-file init-directory)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
795 (find-user-home-directory-init-file home-directory))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
796
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
797 (defun maybe-migrate-user-init-file ()
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
798 "Ask user if she wants to migrate the init file(s) to new location."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
799 (if (and (not load-home-init-file)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
800 (not (find-user-init-directory-init-file user-init-directory))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
801 (stringp user-init-file)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
802 (file-readable-p user-init-file))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
803 (if (with-output-to-temp-buffer (help-buffer-name nil)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
804 (progn
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
805 (princ "XEmacs recommends that the initialization code in
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
806 ")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
807 (princ user-init-file)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
808 (princ "
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
809 be migrated to the ")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
810 (princ user-init-directory)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
811 (princ " directory. XEmacs can
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
812 perform the migration automatically.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
813
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
814 After the migration, init.el/init.elc holds user-written
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
815 initialization code. Moreover the customize settings will be in
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
816 custom.el.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
817
452
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
818 You can undo the migration at any time with
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
819 M-x maybe-unmigrate-user-init-file.
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
820
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
821 If you choose not to do this now, XEmacs will not ask you this
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
822 question in the future. However, you can still make XEmacs
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
823 perform the migration at any time with M-x migrate-user-init-file.")
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
824 (show-temp-buffer-in-current-frame standard-output)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
825 (yes-or-no-p-minibuf (concat "Migrate init file to "
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
826 user-init-directory
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
827 "? "))))
452
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
828 (progn
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
829 (migrate-user-init-file)
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
830 (maybe-create-compatibility-dot-emacs))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
831 (customize-save-variable 'load-home-init-file t))))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
832
452
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
833 (defun maybe-create-compatibility-dot-emacs ()
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
834 "Ask user if she wants to create a .emacs compatibility file."
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
835 (if (with-output-to-temp-buffer (help-buffer-name nil)
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
836 (progn
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
837 (princ "The initialization code has now been migrated to the ")
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
838 (princ user-init-directory)
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
839 (princ "directory.
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
840
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
841 For backwards compatibility with, for example, older versions of XEmacs,
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
842 XEmacs can create a special old-style .emacs file in your home
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
843 directory which will load the relocated initialization code.")
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
844 (show-temp-buffer-in-current-frame standard-output)
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
845 (yes-or-no-p-minibuf "Create compatibility .emacs? ")))
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
846 (create-compatibility-dot-emacs)))
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
847
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
848 (defun migrate-user-init-file ()
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
849 "Migrate the init file from the home directory."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
850 (interactive)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
851 (if (not (file-exists-p user-init-directory))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
852 (progn
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
853 (message "Creating %s directory..." user-init-directory)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
854 (make-directory user-init-directory)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
855 (message "Migrating custom file...")
452
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
856 (customize-set-value 'load-home-init-file nil)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
857 (custom-migrate-custom-file (make-custom-file-name user-init-file
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
858 'force-new))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
859 (message "Moving init file...")
452
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
860 (let ((new-user-init-file (expand-file-name user-init-file-base
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
861 user-init-directory)))
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
862 (rename-file user-init-file new-user-init-file)
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
863 (setq user-init-file new-user-init-file))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
864 (message "Migration done."))
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
865
452
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
866 (defun create-compatibility-dot-emacs ()
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
867 "Create .emacs compatibility file for migrated setup."
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
868 (message "Creating .emacs compatibility file.")
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
869 (with-temp-file (expand-file-name ".emacs" "~")
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
870 (insert ";;; XEmacs backwards compatibility file\n")
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
871 (insert "(setq user-init-file\n")
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
872 (insert " (expand-file-name \"init.el\"\n")
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
873 (insert " (expand-file-name \".xemacs\" \"~\")))\n")
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
874 (insert "(setq custom-file\n")
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
875 (insert " (expand-file-name \"custom.el\"\n")
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
876 (insert " (expand-file-name \".xemacs\" \"~\")))\n")
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
877 (insert "\n")
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
878 (insert "(load-file user-init-file)\n")
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
879 (insert "(load-file custom-file)"))
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
880 (message "Created .emacs compatibility file."))
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
881
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
882 (defun maybe-unmigrate-user-init-file ()
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
883 "Possibly unmigrate the user's init and custom files."
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
884 (interactive)
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
885 (let ((dot-emacs-file-name (expand-file-name ".emacs" "~")))
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
886 (if (and (not load-home-init-file)
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
887 (or (not (file-exists-p dot-emacs-file-name))
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
888 (yes-or-no-p-minibuf (concat "Overwrite " dot-emacs-file-name
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
889 "? "))))
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
890 (unmigrate-user-init-file dot-emacs-file-name))))
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
891
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
892 (defun unmigrate-user-init-file (&optional target-file-name)
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
893 "Unmigrate the user's init and custom files."
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
894 (interactive)
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
895 (let ((target-file-name
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
896 (or target-file-name (expand-file-name ".emacs" "~"))))
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
897 (rename-file user-init-file target-file-name 'ok-if-already-exists)
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
898 (setq user-init-file target-file-name)
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
899 (let ((old-custom-file custom-file))
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
900 (custom-migrate-custom-file target-file-name)
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
901 (customize-save-variable 'load-home-init-file t)
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
902 (delete-file old-custom-file))))
3d3049ae1304 Import from CVS: tag r21-2-41
cvs
parents: 446
diff changeset
903
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
904 (defun load-user-init-file ()
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
905 "This function actually reads the init file."
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
906 (if (not user-init-file)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
907 (setq user-init-file
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
908 (find-user-init-file user-init-directory)))
470
8a548306e08d [xemacs-hg @ 2001-04-17 15:50:10 by didierv]
didierv
parents: 460
diff changeset
909 (if (not custom-file)
8a548306e08d [xemacs-hg @ 2001-04-17 15:50:10 by didierv]
didierv
parents: 460
diff changeset
910 (setq custom-file (make-custom-file-name user-init-file)))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
911 (if (and user-init-file
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
912 (file-readable-p user-init-file))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
913 (load user-init-file t t t))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
914 (if (and custom-file
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
915 (or (not user-init-file)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
916 (not (string= custom-file user-init-file)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
917 (file-readable-p custom-file))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
918 (load custom-file t t t))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
919 (unless inhibit-default-init
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
920 (let ((inhibit-startup-message nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
921 ;; Users are supposed to be told their rights.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
922 ;; (Plus how to get help and how to undo.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
923 ;; Don't you dare turn this off for anyone except yourself.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
924 (load "default" t t))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
925
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
926 ;;; Load user's init file and default ones.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
927 (defun load-init-file ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
928 (run-hooks 'before-init-hook)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
929
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
930 ;; Run the site-start library if it exists. The point of this file is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
931 ;; that it is run before .emacs. There is no point in doing this after
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
932 ;; .emacs; that is useless.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
933 (when site-start-file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
934 (load site-start-file t t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
935
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
936 ;; Sites should not disable this. Only individuals should disable
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
937 ;; the startup message.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
938 (setq inhibit-startup-message nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
939
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
940 (let (debug-on-error-from-init-file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
941 debug-on-error-should-be-set
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
942 (debug-on-error-initial
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
943 (if (eq init-file-debug t) 'startup init-file-debug)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
944 (let ((debug-on-error debug-on-error-initial))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
945 (if (and load-user-init-file-p init-file-debug)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
946 (progn
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
947 ;; Do this without a condition-case if the user wants to debug.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
948 (load-user-init-file))
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
949 (condition-case nil
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
950 (call-with-condition-handler
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
951 #'(lambda (__load_init_file_arg__)
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
952 (let ((errstr (error-message-string
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
953 __load_init_file_arg__)))
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
954 (message "Error in init file: %s" errstr)
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
955 (lwarn 'initialization 'error
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
956 "\
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
957 An error has occurred while loading %s:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
958
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
959 %s
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
960
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
961 Backtrace follows:
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
962
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
963 %s
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
964
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
965 To ensure normal operation, you should investigate the cause of the error
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
966 in your initialization file and remove it. Use the `-debug-init' option
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
967 to XEmacs to enter the debugger when the error occurs and investigate the
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
968 exact problem."
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
969 user-init-file errstr
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
970 (backtrace-in-condition-handler-eliminating-handler
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
971 '__load_init_file_arg__)))
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
972 (setq init-file-had-error t))
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
973 #'(lambda ()
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
974 (if load-user-init-file-p
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
975 (load-user-init-file))
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
976 (setq init-file-had-error nil)))
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
977 (error nil)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
978 ;; If we can tell that the init file altered debug-on-error,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
979 ;; arrange to preserve the value that it set up.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
980 (or (eq debug-on-error debug-on-error-initial)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
981 (setq debug-on-error-should-be-set t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
982 debug-on-error-from-init-file debug-on-error)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
983 (when debug-on-error-should-be-set
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
984 (setq debug-on-error debug-on-error-from-init-file)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
985
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
986 (setq init-file-loaded t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
987
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
988 ;; Do this here in case the init file sets mail-host-address.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
989 ;; Don't do this here unless noninteractive, it is frequently wrong. -sb
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
990 ;; (or user-mail-address
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
991 (when noninteractive
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
992 (setq user-mail-address (concat (user-login-name) "@"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
993 (or mail-host-address
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
994 (system-name)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
995
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
996 (run-hooks 'after-init-hook)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
997 nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
998
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
999 (defun load-options-file (filename)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1000 "Load the file of saved options (from the Options menu) called FILENAME.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1001 Currently this does nothing but call `load', but it might be redefined
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1002 in the future to support automatically converting older options files to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1003 a new format, when variables have changed, etc."
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1004 (load filename))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1005
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1006 (defun command-line-1 ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1007 (cond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1008 ((null command-line-args-left)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1009 (unless noninteractive
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1010 ;; If there are no switches to process, run the term-setup-hook
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1011 ;; before displaying the copyright notice; there may be some need
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1012 ;; to do it before doing any output. If we're not going to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1013 ;; display a copyright notice (because other options are present)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1014 ;; then this is run after those options are processed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1015 (run-hooks 'term-setup-hook)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1016 ;; Don't let the hook be run twice.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1017 (setq term-setup-hook nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1018
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1019 ;; Don't clobber a non-scratch buffer if init file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1020 ;; has selected it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1021 (when (string= (buffer-name) "*scratch*")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1022 (unless (or inhibit-startup-message
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1023 (input-pending-p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1024 (let (tmout circ-tmout)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1025 (unwind-protect
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1026 ;; Guts of with-timeout
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1027 (catch 'tmout
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1028 (setq tmout (add-timeout startup-message-timeout
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1029 (lambda (ignore)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1030 (condition-case nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1031 (throw 'tmout t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1032 (error nil)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1033 nil))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1034 (setq circ-tmout (display-splash-frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035 (or nil;; (pos-visible-in-window-p (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1036 (goto-char (point-min)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1037 (sit-for 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1038 (setq unread-command-event (next-command-event)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1039 (when tmout (disable-timeout tmout))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1040 (when circ-tmout (disable-timeout circ-tmout)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1041 (with-current-buffer (get-buffer "*scratch*")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1042 ;; In case the XEmacs server has already selected
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1043 ;; another buffer, erase the one our message is in.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1044 (erase-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1045 (when (stringp initial-scratch-message)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1046 (insert initial-scratch-message))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1047 (set-buffer-modified-p nil)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1048
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1049 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1050 ;; Command-line-options exist
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1051 (let ((dir command-line-default-directory)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1052 (file-count 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053 (line nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1054 (end-of-options nil)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1055 file-p arg tem)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1056 (while command-line-args-left
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057 (setq arg (pop command-line-args-left))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 (cond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059 (end-of-options
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1060 (setq file-p t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1061 ((setq tem (when (eq (aref arg 0) ?-)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1062 (or (assoc arg command-switch-alist)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1063 (assoc (substring arg 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1064 command-switch-alist))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1065 (funcall (cdr tem) arg))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1066 ((string-match "\\`\\+[0-9]+\\'" arg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1067 (setq line (string-to-int arg)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1068 ;; "- file" means don't treat "file" as a switch
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1069 ;; ("+0 file" has the same effect; "-" added
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1070 ;; for unixoidiality).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1071 ;; This is worthless; the `unixoid' way is "./file". -jwz
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1072 ((or (string= arg "-") (string= arg "--"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1073 (setq end-of-options t))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1074 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1075 (setq file-p t)))
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1076
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1077 (when file-p
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1078 (setq file-p nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1079 (incf file-count)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1080 (setq arg (expand-file-name arg dir))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1081 (cond
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1082 ((= file-count 1)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1083 (find-file arg))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1084 (noninteractive (find-file arg))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1085 (t (find-file-other-window arg)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1086 (when line
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1087 (goto-line line)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1088 (setq line nil))))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1089
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1090 (defvar startup-presentation-hack-keymap
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1091 (let ((map (make-sparse-keymap)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1092 (set-keymap-name map 'startup-presentation-hack-keymap)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1093 (define-key map '[button1] 'startup-presentation-hack)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1094 (define-key map '[button2] 'startup-presentation-hack)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1095 map)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1096 "Putting yesterday in the future tomorrow.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1097
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1098 (defun startup-presentation-hack ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1099 (interactive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1100 (let ((e last-command-event))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1101 (and (button-press-event-p e)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1102 (setq e (extent-at (event-point e)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1103 (event-buffer e)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1104 'startup-presentation-hack))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1105 (setq e (extent-property e 'startup-presentation-hack))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1106 (if (consp e)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1107 (apply (car e) (cdr e))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1108 (while (keymapp (indirect-function e))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1109 (let ((map e)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1110 (overriding-local-map (indirect-function e)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1111 (setq e (read-key-sequence
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1112 (let ((p (keymap-prompt map t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1113 (cond ((symbolp map)
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1114 (if p
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1115 (format "%s %s " map p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1116 (format "%s " map)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1117 (p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1118 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1119 (prin1-to-string map))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1120 (if (and (button-release-event-p (elt e 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1121 (null (key-binding e)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1122 (setq e map) ; try again
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1123 (setq e (key-binding e)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1124 (call-interactively e)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1125
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1126 (defun startup-presentation-hack-help (e)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1127 (setq e (extent-property e 'startup-presentation-hack))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1128 (if (consp e)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1129 (format "Evaluate %S" e)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1130 (symbol-name e)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1131
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1132 (defun splash-frame-present-hack (e v)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1133 ;; (set-extent-property e 'mouse-face 'highlight)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1134 ;; (set-extent-property e 'keymap
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1135 ;; startup-presentation-hack-keymap)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1136 ;; (set-extent-property e 'startup-presentation-hack v)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1137 ;; (set-extent-property e 'help-echo
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1138 ;; 'startup-presentation-hack-help)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1139 )
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1140
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1141 (defun splash-hack-version-string ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1142 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1143 (save-restriction
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1144 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1145 (re-search-forward "^XEmacs" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1146 (narrow-to-region (point-at-bol) (point-at-eol))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1147 (goto-char (point-min))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1148 (when (re-search-forward " \\[Lucid\\]" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1149 (delete-region (match-beginning 0) (match-end 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1150 (when (re-search-forward "[^(][^)]*-[^)]*-" nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1151 (delete-region (1+ (match-beginning 0)) (match-end 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1152 (insert "("))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1153 (goto-char (point-max))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1154 (search-backward " " nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1155 (when (search-forward "." nil t)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1156 (delete-region (1- (point)) (point-max))))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1157
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1158 (defun splash-frame-present (l)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1159 (cond ((stringp l)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1160 (insert l))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1161 ((eq (car-safe l) 'face)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1162 ;; (face name string)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1163 (let ((p (point)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1164 (splash-frame-present (elt l 2))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1165 (if (fboundp 'set-extent-face)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1166 (set-extent-face (make-extent p (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1167 (elt l 1)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1168 ((eq (car-safe l) 'key)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1169 (let* ((c (elt l 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1170 (p (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1171 (k (where-is-internal c nil t)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1172 (insert (if k (key-description k)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1173 (format "M-x %s" c)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1174 (if (fboundp 'set-extent-face)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1175 (let ((e (make-extent p (point))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1176 (set-extent-face e 'bold)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1177 (splash-frame-present-hack e c)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1178 ((eq (car-safe l) 'funcall)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1179 ;; (funcall (fun . args) string)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1180 (let ((p (point)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1181 (splash-frame-present (elt l 2))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1182 (if (fboundp 'set-extent-face)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1183 (splash-frame-present-hack (make-extent p (point))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1184 (elt l 1)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1185 ((consp l)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1186 (mapcar 'splash-frame-present l))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1187 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1188 (error "WTF!?"))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1189
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1190 (defun startup-center-spaces (glyph)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1191 ;; Return the number of spaces to insert in order to center
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1192 ;; the given glyph (may be a string or a pixmap).
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1193 ;; Assume spaces are as wide as avg-pixwidth.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1194 ;; Won't be quite right for proportional fonts, but it's the best we can do.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1195 ;; Maybe the new redisplay will export something a glyph-width function.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1196 ;;; #### Yes, there is a glyph-width function but it isn't quite what
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1197 ;;; #### this was expecting. Or is it?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1198 ;; (An alternate way to get avg-pixwidth would be to use x-font-properties
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1199 ;; and calculate RESOLUTION_X * AVERAGE_WIDTH / 722.7, but it's no better.)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1200
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1201 ;; This function is used in about.el too.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1202 (let* ((avg-pixwidth (round (/ (frame-pixel-width) (frame-width))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1203 (fill-area-width (* avg-pixwidth (- fill-column left-margin)))
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1204 (glyph-pixwidth (cond ((stringp glyph)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1205 (* avg-pixwidth (length glyph)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1206 ;; #### the pixmap option should be removed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1207 ;;((pixmapp glyph)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1208 ;; (pixmap-width glyph))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1209 ((glyphp glyph)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1210 (glyph-width glyph))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1211 (t
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1212 (error "startup-center-spaces: bad arg")))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1213 (+ left-margin
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1214 (round (/ (/ (- fill-area-width glyph-pixwidth) 2) avg-pixwidth)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1215
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1216 (defun splash-frame-body ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1217 `[((face (blue bold underline)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1218 "\nDistribution, copying license, warranty:\n\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1219 "Please visit the XEmacs website at http://www.xemacs.org !\n\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1220 ,@(if (featurep 'sparcworks)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1221 `( "\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1222 Sun provides support for the WorkShop/XEmacs integration package only.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1223 All other XEmacs packages are provided to you \"AS IS\".\n"
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1224 ,@(let ((lang (or (getenv "LC_ALL") (getenv "LC_MESSAGES")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1225 (getenv "LANG"))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1226 (if (and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1227 (not (featurep 'mule)) ;; Already got mule?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1228 ;; No Mule support on tty's yet
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1229 (not (eq 'tty (console-type)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1230 lang ;; Non-English locale?
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1231 (not (string= lang "C"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1232 (not (string-match "^en" lang))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1233 ;; Comes with Sun WorkShop
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1234 (locate-file "xemacs-mule" exec-path))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1235 '( "\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1236 This version of XEmacs has been built with support for Latin-1 languages only.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1237 To handle other languages you need to run a Multi-lingual (`Mule') version of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1238 XEmacs, by either running the command `xemacs-mule', or by using the X resource
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1239 `ESERVE*defaultXEmacsPath: xemacs-mule' when starting XEmacs from Sun WorkShop.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1240 \n")))))
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1241 ((key describe-no-warranty)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1242 ": "(face (red bold) "XEmacs comes with ABSOLUTELY NO WARRANTY\n"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1243 ((key describe-copying)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1244 ": conditions to give out copies of XEmacs\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1245 ((key describe-distribution)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1246 ": how to get the latest version\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1247 "\n--\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1248 (face italic "\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1249 Copyright (C) 1985-1999 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1250 Copyright (C) 1990-1994 Lucid, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1251 Copyright (C) 1993-1997 Sun Microsystems, Inc. All Rights Reserved.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1252 Copyright (C) 1994-1996 Board of Trustees, University of Illinois
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1253 Copyright (C) 1995-1996 Ben Wing\n"))
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1254
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1255 ((face (blue bold underline) "\nInformation, on-line help:\n\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1256 "XEmacs comes with plenty of documentation...\n\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1257 ,@(if (string-match "beta" emacs-version)
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1258 `((key describe-beta)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1259 ": " (face (red bold)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1260 "This is an Experimental version of XEmacs.\n"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1261 `( "\n"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1262 ((key xemacs-local-faq)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1263 ": read the XEmacs FAQ (a " (face underline "capital") " F!)\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1264 ((key help-with-tutorial)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1265 ": read the XEmacs tutorial (also available through the "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1266 (face bold "Help") " menu)\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1267 ((key help-command)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1268 ": get help on using XEmacs (also available through the "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1269 (face bold "Help") " menu)\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1270 ((key info) ": read the on-line documentation\n\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1271 ((key describe-project) ": read about the GNU project\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1272 ((key about-xemacs) ": see who's developing XEmacs\n"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1273
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1274 ((face (blue bold underline) "\nUseful stuff:\n\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1275 "Things that you should know rather quickly...\n\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1276 ((key find-file) ": visit a file\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1277 ((key save-buffer) ": save changes\n")
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 684
diff changeset
1278 ((key undo) ": undo changes\n")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1279 ((key save-buffers-kill-emacs) ": exit XEmacs\n"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1280 ])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1281
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1282 ;; I really hate global variables, oh well.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1283 ;(defvar xemacs-startup-logo-function nil
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1284 ; "If non-nil, function called to provide the startup logo.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1285 ;This function should return an initialized glyph if it is used.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1286
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
1287 ;; This will hopefully go away when gettext is functional.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1288 (defconst splash-frame-static-body
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1289 `(,(emacs-version) "\n\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1290 (face italic "`C-' means the control key,`M-' means the meta key\n\n")))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1291
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1292
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1293 (defun circulate-splash-frame-elements (client-data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1294 (with-current-buffer (aref client-data 2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1295 (let ((buffer-read-only nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1296 (elements (aref client-data 3))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1297 (indice (aref client-data 0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1298 (goto-char (aref client-data 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1299 (delete-region (point) (point-max))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1300 (splash-frame-present (aref elements indice))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1301 (set-buffer-modified-p nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1302 (aset client-data 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1303 (if (= indice (- (length elements) 1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1304 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1305 (1+ indice )))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1306 )))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1307
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1308 ;; #### This function now returns the (possibly nil) timeout circulating the
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1309 ;; splash-frame elements
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1310 (defun display-splash-frame ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1311 (let ((logo xemacs-logo)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1312 (buffer-read-only nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1313 (cramped-p (eq 'tty (console-type))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1314 (unless cramped-p (insert "\n"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1315 (indent-to (startup-center-spaces logo))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1316 (set-extent-begin-glyph (make-extent (point) (point)) logo)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1317 ;;(splash-frame-present-hack (make-extent p (point)) 'about-xemacs))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1318 (insert "\n\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1319 (splash-frame-present splash-frame-static-body)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1320 (splash-hack-version-string)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1321 (goto-char (point-max))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1322 (let* ((after-change-functions nil) ; no font-lock, thank you
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1323 (elements (splash-frame-body))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1324 (client-data `[ 1 ,(point) ,(current-buffer) ,elements ])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1325 tmout)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1326 (if (listp elements) ;; A single element to display
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1327 (splash-frame-present (splash-frame-body))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1328 ;; several elements to rotate
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1329 (splash-frame-present (aref elements 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1330 (setq tmout (add-timeout splash-frame-timeout
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1331 'circulate-splash-frame-elements
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1332 client-data splash-frame-timeout)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1333 (set-buffer-modified-p nil)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1334 tmout)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1335
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1336 ;; (let ((present-file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1337 ;; #'(lambda (f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1338 ;; (splash-frame-present
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1339 ;; (list 'funcall
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1340 ;; (list 'find-file-other-window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1341 ;; (expand-file-name f data-directory))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1342 ;; f)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1343 ;; (insert "For customization examples, see the files ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1344 ;; (funcall present-file "sample.emacs")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1345 ;; (insert " and ")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1346 ;; (funcall present-file "sample.Xdefaults")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1347 ;; (insert (format "\nin the directory %s." data-directory)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1348
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1349 (defun startup-set-invocation-environment ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1350 ;; XEmacs -- Steven Baur says invocation directory is nil if you
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1351 ;; try to use XEmacs as a login shell.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1352 (or invocation-directory (setq invocation-directory default-directory))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1353 (setq invocation-directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1354 ;; don't let /tmp_mnt/... get into the load-path or exec-path.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1355 (abbreviate-file-name invocation-directory)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1356
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1357 (defun startup-find-roots-warning ()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1358 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1359 (set-buffer (get-buffer-create " *warning-tmp*"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1360 (erase-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1361 (buffer-disable-undo (current-buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1362
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1363 (insert "Couldn't find an obvious default for the root of the\n"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1364 "XEmacs hierarchy.")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1365
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1366 (princ "\nWARNING:\n" 'external-debugging-output)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1367 (princ (buffer-string) 'external-debugging-output)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1368
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1369 (defun startup-setup-paths-warning ()
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1370 (let ((warnings '()))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1371 (cond
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1372 ((null (and lisp-directory exec-directory data-directory doc-directory
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1373 load-path))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1374 (save-excursion
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1375 (set-buffer (get-buffer-create " *warning-tmp*"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1376 (erase-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1377 (buffer-disable-undo (current-buffer))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1378 (if (null lisp-directory) (push "lisp-directory" warnings))
460
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 458
diff changeset
1379 (if (and (featurep 'mule)
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 458
diff changeset
1380 (null mule-lisp-directory))
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 458
diff changeset
1381 (push "mule-lisp-directory" warnings))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1382 (if (null exec-directory) (push "exec-directory" warnings))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1383 (if (null data-directory) (push "data-directory" warnings))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1384 (if (null doc-directory) (push "doc-directory" warnings))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1385 (if (null load-path) (push "load-path" warnings))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1386
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1387 (insert "Couldn't find obvious defaults for:\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1388 (while warnings
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1389 (insert (car warnings) "\n")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1390 (setq warnings (cdr warnings)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1391 (insert "Perhaps some directories don't exist, "
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1392 "or the XEmacs executable,\n" (concat invocation-directory
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1393 invocation-name)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1394 "\nis in a strange place?")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1395
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1396 (princ "\nWARNING:\n" 'external-debugging-output)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1397 (princ (buffer-string) 'external-debugging-output)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1398 (erase-buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1399 t)))))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1400
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 502
diff changeset
1401 (defun startup-load-autoloads ()
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 502
diff changeset
1402 (if (and (not inhibit-autoloads)
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 502
diff changeset
1403 lisp-directory)
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 502
diff changeset
1404 (load (expand-file-name (file-name-sans-extension autoload-file-name)
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 502
diff changeset
1405 lisp-directory) nil t))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 502
diff changeset
1406
776
79940b592197 [xemacs-hg @ 2002-03-15 07:43:14 by ben]
ben
parents: 771
diff changeset
1407 (if (and (not inhibit-autoloads) (not inhibit-all-packages))
528
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 502
diff changeset
1408 (progn
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 502
diff changeset
1409 (if (not inhibit-early-packages)
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 502
diff changeset
1410 (packages-load-package-auto-autoloads early-package-load-path))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 502
diff changeset
1411 (packages-load-package-auto-autoloads late-package-load-path)
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 502
diff changeset
1412 (packages-load-package-auto-autoloads last-package-load-path))))
ef4d2466a29c [xemacs-hg @ 2001-05-10 09:59:45 by ben]
ben
parents: 502
diff changeset
1413
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1414 ;;; startup.el ends here