diff src/emacs.c @ 1315:70921960b980

[xemacs-hg @ 2003-02-20 08:19:28 by ben] check in makefile fixes et al Makefile.in.in: Major surgery. Move all stuff related to building anything in the src/ directory into src/. Simplify the dependencies -- everything in src/ is dependent on the single entry `src' in MAKE_SUBDIRS. Remove weirdo targets like `all-elc[s]', dump-elc[s], etc. mule/mule-msw-init.el: Removed. Delete this file. mule/mule-win32-init.el: New file, with stuff from mule-msw-init.el -- not just for MS Windows native, boys and girls! bytecomp.el: Change code inserted to catch trying to load a Mule-only .elc file in a non-Mule XEmacs. Formerly you got the rather cryptic "The required feature `mule' cannot be provided". Now you get "Loading this file requires Mule support". finder.el: Remove dependency on which directory this function is invoked from. update-elc.el: Don't mess around with ../src/BYTECOMPILE_CHANGE. Now that Makefile.in.in and xemacs.mak are in sync, both of them use NEEDTODUMP and the other one isn't used. dumped-lisp.el: Rewrite in terms of `list' and `nconc' instead of assemble-list, so we can have arbitrary forms, not just `when-feature'. very-early-lisp.el: Nuke this file. finder-inf.el, packages.el, update-elc.el, update-elc-2.el, loadup.el, make-docfile.el: Eliminate references to very-early-lisp. msw-glyphs.el: Comment clarification. xemacs.mak: Add macros DO_TEMACS, DO_XEMACS, and a few others; this macro section is now completely in sync with src/Makefile.in.in. Copy check-features, load-shadows, and rebuilding finder-inf.el from src/Makefile.in.in. The main build/dump/recompile process is now synchronized with src/Makefile.in.in. Change `WARNING' to `NOTE' and `error checking' to `error-checking' TO avoid tripping faux warnings and errors in the VC++ IDE. Makefile.in.in: Major surgery. Move all stuff related to building anything in the src/ directory from top-level Makefile.in.in to here. Simplify the dependencies. Rearrange into logical subsections. Synchronize the main compile/dump/build-elcs section with xemacs.mak, which is already clean and in good working order. Remove weirdo targets like `all-elc[s]', dump-elc[s], etc. Add additional levels of macros \(e.g. DO_TEMACS, DO_XEMACS, TEMACS_BATCH, XEMACS_BATCH, XEMACS_BATCH_PACKAGES) to factor out duplicated stuff. Clean up handling of "HEAP_IN_DATA" (Cygwin) so it doesn't need to ignore the return value from dumping. Add .NO_PARALLEL since various aspects of building and dumping must be serialized but do not always have dependencies between them (this is impossible in some cases). Everything related to src/ now gets built in one pass in this directory by just running `make' (except the Makefiles themselves and config.h, paths.h, Emacs.ad.h, and other generated .h files). console.c: Update list of possibly valid console types. emacs.c: Rationalize the specifying and handling of the type of the first frame. This was originally prompted by a workspace in which I got GTK to compile under C++ and in the process fixed it so it could coexist with X in the same build -- hence, a combined TTY/X/MS-Windows/GTK build is now possible under Cygwin. (However, you can't simultaneously *display* more than one kind of device connection -- but getting that to work is not that difficult. Perhaps a project for a bored grad student. I (ben) would do it but don't see the use.) To make sense of this, I added new switches that can be used to specifically indicate the window system: -x [aka --use-x], -tty \[aka --use-tty], -msw [aka --use-ms-windows], -gtk [aka --use-gtk], and -gnome [aka --use-gnome, same as --use-gtk]. -nw continues as an alias for -tty. When none have been given, XEmacs checks for other parameters implying particular device types (-t -> tty, -display -> x [or should it have same treatment as DISPLAY below?]), and has ad-hoc logic afterwards: if env var DISPLAY is set, use x (or gtk? perhaps should check whether gnome is running), else MS Windows if it exsits, else TTY if it exists, else stream, and you must be running in batch mode. This also fixes an existing bug whereby compiling with no x, no mswin, no tty, when running non- interactively (e.g. to dump) I get "sorry, must have TTY support". emacs.c: Turn on Vstack_trace_on_error so that errors are debuggable even when occurring extremely early in reinitialization. emacs.c: Try to make sure that the user can see message output under Windows (i.e. it doesn't just disappear right away) regardless of when it occurs, e.g. in the middle of creating the first frame. emacs.c: Define new function `emacs-run-status', indicating whether XEmacs is noninteractive or interactive, whether raw, post-dump/pdump-load or run-temacs, whether we are dumping, whether pdump is in effect. event-stream.c: It's "mommas are fat", not "momas are fat". Fix other typo. event-stream.c: Conditionalize in_menu_callback check on HAVE_MENUBARS, because it won't exist on w/o menubar support, lisp.h: More hackery on RETURN_NOT_REACHED. Cygwin v3.2 DOES complain here if RETURN_NOT_REACHED() is blank, as it is for GCC 2.5+. So make it blank only for GCC 2.5 through 2.999999999999999. Declare Vstack_trace_on_error. profile.c: Need to include "profile.h" to fix warnings. sheap.c: Don't fatal() when need to rerun Make, just stderr_out() and exit(0). That way we can distinguish between a dumping failing expectedly (due to lack of stack space, triggering another dump) and unexpectedly, in which case, we want to stop building. (or go on, if -K is given) syntax.c, syntax.h: Use ints where they belong, and enum syntaxcode's where they belong, and fix warnings thereby. syntax.h: Fix crash caused by an edge condition in the syntax-cache macros. text.h: Spacing fixes. xmotif.h: New file, to get around shadowing warnings. EmacsManager.c, event-Xt.c, glyphs-x.c, gui-x.c, input-method-motif.c, xmmanagerp.h, xmprimitivep.h: Include xmotif.h. alloc.c: Conditionalize in_malloc on ERROR_CHECK_MALLOC. config.h.in, file-coding.h, fileio.c, getloadavg.c, select-x.c, signal.c, sysdep.c, sysfile.h, systime.h, text.c, unicode.c: Eliminate HAVE_WIN32_CODING_SYSTEMS, use WIN32_ANY instead. Replace defined (WIN32_NATIVE) || defined (CYGWIN) with WIN32_ANY. lisp.h: More futile attempts to walk and chew gum at the same time when dealing with subr's that don't return.
author ben
date Thu, 20 Feb 2003 08:19:44 +0000
parents f99d3d25df86
children 4542b72c005e
line wrap: on
line diff
--- a/src/emacs.c	Thu Feb 20 08:16:21 2003 +0000
+++ b/src/emacs.c	Thu Feb 20 08:19:44 2003 +0000
@@ -2,7 +2,7 @@
    Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994
    Free Software Foundation, Inc.
    Copyright (C) 1995 Sun Microsystems, Inc.
-   Copyright (C) 2000, 2001, 2002 Ben Wing.
+   Copyright (C) 2000, 2001, 2002, 2003 Ben Wing.
 
 This file is part of XEmacs.
 
@@ -268,7 +268,7 @@
 #include TT_C_H_FILE
 #endif
 
-#if defined (WIN32_NATIVE) || defined (CYGWIN)
+#ifdef WIN32_ANY
 #include "console-msw.h"
 #endif
 
@@ -466,6 +466,8 @@
 Lisp_Object Qkill_emacs_hook;
 Lisp_Object Qsave_buffers_kill_emacs;
 
+Lisp_Object Qtemacs, Qdumping, Qrestarted, Qpdump, Qbatch;
+
 /* Nonzero if handling a fatal error already. */
 int fatal_error_in_progress;
 
@@ -678,6 +680,15 @@
     }
 }
 
+static void
+check_compatible_window_system (char *must)
+{
+  if (display_use && strcmp (display_use, must))
+    fatal ("Incompatible window system type `%s': `%s' already specified",
+	   must, display_use);
+  display_use = must;
+}
+
 
 /************************************************************************/
 /*                   main and friends: XEmacs startup                   */
@@ -703,7 +714,6 @@
   char stack_bottom_variable;
   int skip_args = 0;
   Lisp_Object load_me;
-  int inhibit_window_system;
 #ifdef NeXT
   extern int malloc_cookie;
 #endif
@@ -730,6 +740,7 @@
 #endif /* not SYSTEM_MALLOC or HAVE_LIBMCHECK or DOUG_LEA_MALLOC */
 
   noninteractive = 0;
+  display_use = 0;
   inhibit_non_essential_printing_operations = 1;
 
 #ifdef NeXT
@@ -803,12 +814,6 @@
   EXTRA_INITIALIZE;
 #endif
 
-#ifdef HAVE_WINDOW_SYSTEM
-  inhibit_window_system = 0;
-#else
-  inhibit_window_system = 1;
-#endif
-
   /* NOTE NOTE NOTE: Keep the following args in sync with the big list of
      arguments below in standard_args[], with the help text in startup.el,
      and with the list of non-clobbered variables near where pdump_load()
@@ -826,36 +831,11 @@
       exit (0);
     }
 
-  /* Handle the -t switch, which specifies filename to use as terminal */
-  {
-    Extbyte *term;
-    if (argmatch (argv, argc, "-t", "--terminal", 0, &term, &skip_args))
-      {
-	retry_close (0);
-	retry_close (1);
-	if (open (term, O_RDWR | OPEN_BINARY, 2) < 0)
-	  fatal ("%s: %s", term, strerror (errno));
-	dup (0);
-	if (! isatty (0))
-	  fatal ("%s: not a tty", term);
-
-#if 0
-	stderr_out ("Using %s", ttyname (0));
-#endif
-	stderr_out ("Using %s", term);
-	inhibit_window_system = 1;	/* -t => -nw */
-      }
-  }
-
   /* Handle the --no-dump-file/-nd switch, which means don't load the dump
      file (ignored when not using pdump) */
   if (argmatch (argv, argc, "-nd", "--no-dump-file", 0, NULL, &skip_args))
     nodumpfile = 1;
 
-  /* Handle -nw switch */
-  if (argmatch (argv, argc, "-nw", "--no-windows", 0, NULL, &skip_args))
-    inhibit_window_system = 1;
-
   /* Handle the -batch switch, which means don't do interactive display.  */
   if (argmatch (argv, argc, "-batch", "--batch", 0, NULL, &skip_args))
     {
@@ -950,35 +930,85 @@
 
   /* Now, figure out which type of console is our first console. */
 
-  display_arg = 0;
-
   if (noninteractive)
     display_use = "stream";
-  else
-    display_use = "tty";
-
+
+  if (argmatch (argv, argc, "-nw", "--no-windows", 0, NULL, &skip_args) ||
+      argmatch (argv, argc, "-tty", "--use-tty", 0, NULL, &skip_args))
+    {
+      check_compatible_window_system ("tty");
 #ifndef HAVE_TTY
-  if (inhibit_window_system)
-    fatal ("Sorry, this XEmacs was not compiled with TTY support");
-#endif
-
-#ifdef HAVE_WINDOW_SYSTEM
+      fatal ("Sorry, this XEmacs was not compiled with TTY support");
+#endif
+    }
+
+  if (argmatch (argv, argc, "-x", "--use-x", 0, NULL, &skip_args))
+    {
+      check_compatible_window_system ("x");
+#ifndef HAVE_X_WINDOWS
+      fatal ("Sorry, this XEmacs was not compiled with X support");
+#endif
+    }
+
+  if (argmatch (argv, argc, "-gtk", "--use-gtk", 0, NULL, &skip_args) ||
+      argmatch (argv, argc, "-gnome", "--use-gnome", 0, NULL, &skip_args))
+    {
+      check_compatible_window_system ("gtk");
+#ifndef HAVE_GTK
+      fatal ("Sorry, this XEmacs was not compiled with GTK support");
+#endif
+    }
+
+  if (argmatch (argv, argc, "-msw", "--use-ms-windows", 0, NULL, &skip_args))
+    {
+      check_compatible_window_system ("mswindows");
+#ifndef HAVE_MS_WINDOWS
+      fatal ("Sorry, this XEmacs was not compiled with MS Windows support");
+#endif
+    }
+
+  /* Handle other switches implying particular window systems: */
+
+  /* Handle the -t switch, which specifies filename to use as terminal */
+  {
+    Extbyte *term;
+    if (argmatch (argv, argc, "-t", "--terminal", 0, &term, &skip_args))
+      {
+	check_compatible_window_system ("tty");
+#ifndef HAVE_TTY
+	fatal ("Sorry, this XEmacs was not compiled with TTY support");
+#endif
+
+	retry_close (0);
+	retry_close (1);
+	if (open (term, O_RDWR | OPEN_BINARY, 2) < 0)
+	  fatal ("%s: %s", term, strerror (errno));
+	dup (0);
+	if (! isatty (0))
+	  fatal ("%s: not a tty", term);
+
+#if 0
+	stderr_out ("Using %s", ttyname (0));
+#endif
+	stderr_out ("Using %s", term);
+      }
+  }
+
   /* Stupid kludge to catch command-line display spec.  We can't
      handle this argument entirely in window-system-dependent code
      because we don't even know which window-system-dependent code
      to run until we've recognized this argument.  */
-  if (!inhibit_window_system && !noninteractive)
-    {
+  {
 #ifdef HAVE_X_WINDOWS
-      char *dpy = 0;
-      int count_before = skip_args;
-
-      if (argmatch (argv, argc, "-d", "--display", 3, &dpy, &skip_args) ||
-	  argmatch (argv, argc, "-display", 0,     3, &dpy, &skip_args))
-	{
-	  display_arg = 1;
-	  display_use = "x";
-	}
+    char *dpy = 0;
+    int count_before = skip_args;
+
+    if (argmatch (argv, argc, "-d", "--display", 3, &dpy, &skip_args) ||
+	argmatch (argv, argc, "-display", 0,     3, &dpy, &skip_args))
+      {
+	check_compatible_window_system ("x");
+	display_arg = 1;
+      }
       /* If we have the form --display=NAME,
 	 convert it into  -d name.
 	 This requires inserting a new element into argv.  */
@@ -1003,27 +1033,43 @@
 
       /* Don't actually discard this arg.  */
       skip_args = count_before;
-
-      /* If there is a non-empty environment var DISPLAY, set
-         `display_use', but not `display_arg', which is only to be set
-         if the display was specified on the command line. */
+#endif /* HAVE_X_WINDOWS */
+  }
+
+  /* If no switch telling us which window system to use, try other
+     possibilities: */
+
+#if defined (HAVE_X_WINDOWS) || defined (HAVE_GTK)
+  if (!display_use)
+    {
+      char *dpy;
+      /* If there is a non-empty environment var DISPLAY, assume X or GTK,
+	 but don't set `display_arg', which is only to be set if the
+	 display was specified on the command line. */
       if ((dpy = getenv ("DISPLAY")) && dpy[0])
+#ifdef HAVE_X_WINDOWS
+	/* #### Who gets precedence?  X or GTK?  For the moment, GTK support is
+	   unstable so use X.  Maybe eventually we will switch this. */
 	display_use = "x";
-
-#endif /* HAVE_X_WINDOWS */
-#ifdef HAVE_GTK
-      {
-	char *dpy = getenv ("DISPLAY");
-	if (dpy && dpy[0])
-	  display_use = "gtk";
-      }
-#endif
+#else
+	display_use = "gtk";
+#endif
+    }
+#endif /* defined (HAVE_X_WINDOWS) || defined (HAVE_GTK) */
+
 #ifdef HAVE_MS_WINDOWS
-      if (strcmp (display_use, "x") != 0)
-	display_use = "mswindows";
+  if (!display_use)
+    display_use = "mswindows";
 #endif /* HAVE_MS_WINDOWS */
-    }
-#endif /* HAVE_WINDOW_SYSTEM */
+
+#ifdef HAVE_TTY
+  if (!display_use)
+    display_use = "tty";
+#endif /* HAVE_MS_WINDOWS */
+
+  if (!display_use)
+    fatal ("No window systems and no TTY's in this XEmacs: Must specify "
+	   "-batch");
 
   noninteractive1 = noninteractive;
 
@@ -1069,7 +1115,7 @@
 				       As early as possible, of course,
 				       so we can be fairly accurate. */
 
-#ifdef HAVE_WIN32_CODING_SYSTEMS
+#ifdef WIN32_ANY
   init_win32_very_early ();
 #endif
 #ifdef HAVE_MS_WINDOWS
@@ -1137,7 +1183,7 @@
       inhibit_site_modules   = inhibit_site_modules_save;
 
       if (initialized)
-	run_temacs_argc = -1;
+	run_temacs_argc = restart ? -2 : -1;
       else
 	purify_flag = 1;
     }
@@ -1373,7 +1419,7 @@
       syms_of_dired_mswindows ();
       syms_of_nt ();
 #endif
-#if defined (WIN32_NATIVE) || defined (CYGWIN)
+#ifdef WIN32_ANY
       syms_of_win32 ();
 #endif
 
@@ -1391,7 +1437,7 @@
 #endif /* HAVE_CANNA */
 #endif /* MULE */
 
-#ifdef HAVE_WIN32_CODING_SYSTEMS
+#ifdef WIN32_ANY
       syms_of_intl_win32 ();
 #endif
 
@@ -1556,7 +1602,7 @@
 
       coding_system_type_create ();
       coding_system_type_create_unicode ();
-#ifdef HAVE_WIN32_CODING_SYSTEMS
+#ifdef WIN32_ANY
       coding_system_type_create_intl_win32 ();
 #endif
 #ifdef MULE
@@ -1751,7 +1797,7 @@
       vars_of_indent ();
       vars_of_insdel ();
       vars_of_intl ();
-#ifdef HAVE_WIN32_CODING_SYSTEMS
+#ifdef WIN32_ANY
       vars_of_intl_win32 ();
 #endif
 #ifdef HAVE_XIM
@@ -1813,7 +1859,7 @@
 #endif
       vars_of_undo ();
       vars_of_window ();
-#if defined (WIN32_NATIVE) || defined (CYGWIN)
+#ifdef WIN32_ANY
       vars_of_win32 ();
 #endif
 
@@ -1967,7 +2013,7 @@
 	 complex_vars_of_(), for example if a charset appears anywhere,
 	 then we suddenly have dependence on the previous call. */
       complex_vars_of_file_coding ();
-#ifdef HAVE_WIN32_CODING_SYSTEMS
+#ifdef WIN32_ANY
       complex_vars_of_intl_win32 ();
 #endif
 
@@ -2089,7 +2135,7 @@
 
       reinit_coding_system_type_create ();
       reinit_coding_system_type_create_unicode ();
-#ifdef HAVE_WIN32_CODING_SYSTEMS
+#ifdef WIN32_ANY
       reinit_coding_system_type_create_intl_win32 ();
 #endif
 #ifdef MULE
@@ -2205,7 +2251,7 @@
      to be done both at dump time and at run time.  Some will be done
      only at run time, by querying the `initialized' variable. */
 
-#if defined (WIN32_NATIVE) || defined (CYGWIN)
+#ifdef WIN32_ANY
   init_intl_win32 (); /* Under Windows, determine whether we use Unicode
 			 or ANSI to call the system routines -- i.e.
 			 determine what the coding system `mswindows-tstr'
@@ -2258,7 +2304,7 @@
 #ifdef SUNPRO
   init_sunpro (); /* Set up Sunpro usage tracking */
 #endif
-#if defined (WIN32_NATIVE) || defined (CYGWIN)
+#ifdef WIN32_ANY
   init_win32 ();
 #endif
 #if defined (HAVE_NATIVE_SOUND) && defined (hp9000s800)
@@ -2374,9 +2420,7 @@
   /* Handled by main_1 above: Each must have its own priority and must be
      in the order mentioned in main_1. */
   { "-sd", "--show-dump-id", 105, 0 },
-  { "-t", "--terminal", 100, 1 },
   { "-nd", "--no-dump-file", 95, 0 },
-  { "-nw", "--no-windows", 90, 0 },
   { "-batch", "--batch", 88, 0 },
 #ifdef WIN32_NATIVE
   { "-mswindows-termination-handle", 0, 84, 1 },
@@ -2391,8 +2435,15 @@
   { "-help", "--help", 72, 0 },
   { "-version", "--version", 70, 0 },
   { "-V", 0, 68, 0 },
-  { "-d", "--display", 66, 1 },
-  { "-display", 0, 64, 1 },
+  { "-nw", "--no-windows", 66, 0 },
+  { "-tty", "--use-tty", 65, 0 },
+  { "-x", "--use-x", 64, 0 },
+  { "-gtk", "--use-gtk", 63, 0 },
+  { "-gnome", "--use-gnome", 62, 0 },
+  { "-msw", "--use-ms-windows", 61, 0 },
+  { "-t", "--terminal", 58, 1 },
+  { "-d", "--display", 57, 1 },
+  { "-display", 0, 56, 1 },
 
   /* Handled by command-line-early in startup.el: */
   { "-q", "--no-init-file", 50, 0 },
@@ -2560,7 +2611,8 @@
       if (best < 0)
 	abort ();
 
-      /* Copy the highest priority remaining option, with its args, to NEW_ARGV.  */
+      /* Copy the highest priority remaining option, with its args, to
+	 NEW_ARGV.  */
       new_argv[to++] = argv[best];
       for (i = 0; i < options[best]; i++)
 	new_argv[to++] = argv[best + i + 1];
@@ -2587,6 +2639,48 @@
   return run_temacs_argc >= 0 ? Qt : Qnil;
 }
 
+DEFUN ("emacs-run-status", Femacs_run_status, 0, 0, 0, /*
+Plist of values indicating the current run status of this XEmacs.
+Currently defined values:
+
+`temacs'
+  If non-nil, we are running a "raw temacs" (no dump data is present
+  and `run-emacs-from-temacs' not called). (same as `running-temacs-p')
+
+`dumping'
+  If non-nil, we are in the process of creating dump data. (same as
+  `purify-flag')
+
+`restarted'
+  If non-nil, `run-emacs-from-temacs' was called.
+
+`pdump'
+  If non-nil, we were compiled with pdump (portable dumping) support.
+
+`batch'
+  If non-nil, we are running non-interactively. (same as `noninteractive')
+*/
+       ())
+{
+  Lisp_Object plist = Qnil;
+
+#define ADD_PLIST(key, val) plist = Fcons (val, Fcons (key, plist))
+  if (run_temacs_argc >= 0)
+    ADD_PLIST (Qtemacs, Qt);
+  if (purify_flag)
+    ADD_PLIST (Qdumping, Qt);
+  if (run_temacs_argc == -2)
+    ADD_PLIST (Qrestarted, Qt);
+#ifdef PDUMP
+    ADD_PLIST (Qpdump, Qt);
+#endif
+    if (noninteractive)
+    ADD_PLIST (Qbatch, Qt);
+
+#undef ADD_PLIST
+    return Fnreverse (plist);
+}
+
 DEFUN ("run-emacs-from-temacs", Frun_emacs_from_temacs, 0, MANY, 0, /*
 Do not call this.  It will reinitialize your XEmacs.  You'll be sorry.
 */
@@ -2654,6 +2748,12 @@
 #if defined (HEAP_IN_DATA) && !defined (PDUMP)
   report_sheap_usage (0);
 #endif
+
+  /* run-temacs usually only occurs as a result of building, and in all such
+     cases we want a backtrace, even if it occurs very early. */
+  if (NILP (Vstack_trace_on_error))
+    Vstack_trace_on_error = Qt;
+
   LONGJMP (run_temacs_catch, 1);
   RETURN_NOT_REACHED (Qnil);
 }
@@ -2750,7 +2850,7 @@
       {
 	extern char **_environ;
 	if ((unsigned) environ == 0)
-	  environ=_environ;
+	  environ = _environ;
       }
 #endif /* _SCO_DS */
       vol_envp = environ;
@@ -2787,7 +2887,7 @@
     }
 #endif /* DOUG_LEA_MALLOC */
 
-  run_temacs_argc = -1;
+  run_temacs_argc = -2;
 
   main_1 (vol_argc, vol_argv, vol_envp, restarted);
 
@@ -2984,7 +3084,7 @@
   debugging_breakpoint ();
 }
 
-#if defined (WIN32_NATIVE) || defined (CYGWIN)
+#ifdef WIN32_ANY
 
 /* Return whether all bytes in the specified memory block can be read. */
 int
@@ -2993,7 +3093,7 @@
   return !IsBadReadPtr (ptr, len);
 }
 
-#else /* !(defined (WIN32_NATIVE) || defined (CYGWIN)) */
+#else /* !WIN32_ANY */
 
 /* #### There must be a better way!!!! */
 
@@ -3041,7 +3141,7 @@
   return retval;
 }
 
-#endif /* defined (WIN32_NATIVE) || defined (CYGWIN) */
+#endif /* WIN32_ANY */
 
 #ifdef DEBUG_XEMACS
 
@@ -3082,7 +3182,7 @@
 {
   static int already_paused;
 
-  if (already_paused || !noninteractive)
+  if (already_paused)
     return;
   if (!allow_further)
     already_paused = 1;
@@ -3090,7 +3190,11 @@
      user to see this message.  This may be unnecessary, but can't hurt,
      and we can't necessarily check arg; e.g. xemacs --help kills with
      argument 0. */
-  if (mswindows_message_outputted)
+  if (mswindows_message_outputted &&
+      /* noninteractive, we always show the box.  Else,
+	 do it when there is not yet an initial frame -- in such case,
+	 XEmacs will just die immediately and we wouldn't see anything. */
+      (noninteractive || NILP (Fselected_frame (Qnil))))
     Fmswindows_message_box
       (build_msg_string ("Messages outputted.  XEmacs is exiting."),
        Qnil, Qnil);
@@ -3704,6 +3808,7 @@
 
   DEFSUBR (Frun_emacs_from_temacs);
   DEFSUBR (Frunning_temacs_p);
+  DEFSUBR (Femacs_run_status);
   DEFSUBR (Finvocation_name);
   DEFSUBR (Finvocation_directory);
   DEFSUBR (Fkill_emacs);
@@ -3721,6 +3826,12 @@
 
   DEFSYMBOL (Qkill_emacs_hook);
   DEFSYMBOL (Qsave_buffers_kill_emacs);
+
+  DEFSYMBOL (Qtemacs);
+  DEFSYMBOL (Qdumping);
+  DEFSYMBOL (Qrestarted);
+  DEFSYMBOL (Qpdump);
+  DEFSYMBOL (Qbatch);
 }
 
 /* Yuck!  These variables may get set from command-line options when