]> code.delx.au - gnu-emacs/blobdiff - src/emacs.c
Merge from emacs--devo--0
[gnu-emacs] / src / emacs.c
index 352b22ca94312ad91e837cf8f27a440b73422631..373eab33e1139be11c360fafac26dbe5a48da44b 100644 (file)
@@ -1,12 +1,12 @@
 /* Fully extensible Emacs, running on Unix, intended for GNU.
    Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1998, 1999,
-                 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+                 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
 GNU Emacs is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
@@ -57,6 +57,7 @@ Boston, MA 02110-1301, USA.  */
 #include "blockinput.h"
 #include "syssignal.h"
 #include "process.h"
+#include "frame.h"
 #include "termhooks.h"
 #include "keyboard.h"
 #include "keymap.h"
@@ -133,8 +134,8 @@ Lisp_Object Vinstallation_directory;
 /* Hook run by `kill-emacs' before it does really anything.  */
 Lisp_Object Vkill_emacs_hook;
 
-/* An empty lisp string.  To avoid having to build any other.  */
-Lisp_Object empty_string;
+/* Empty lisp strings.  To avoid having to build any others.  */
+Lisp_Object empty_unibyte_string, empty_multibyte_string;
 
 /* Search path separator.  */
 Lisp_Object Vpath_separator;
@@ -214,7 +215,7 @@ static unsigned long heap_bss_diff;
 
 
 #ifdef HAVE_WINDOW_SYSTEM
-extern Lisp_Object Vwindow_system;
+extern Lisp_Object Vinitial_window_system;
 #endif /* HAVE_WINDOW_SYSTEM */
 
 extern Lisp_Object Vauto_save_list_file_name;
@@ -856,17 +857,23 @@ main (argc, argv
          So ignore --version otherwise.  */
       && initialized)
     {
-      Lisp_Object tem;
+      Lisp_Object tem, tem2;
       tem = Fsymbol_value (intern ("emacs-version"));
+      tem2 = Fsymbol_value (intern ("emacs-copyright"));
       if (!STRINGP (tem))
        {
          fprintf (stderr, "Invalid value of `emacs-version'\n");
          exit (1);
        }
+      if (!STRINGP (tem2))
+       {
+         fprintf (stderr, "Invalid value of `emacs-copyright'\n");
+         exit (1);
+       }
       else
        {
          printf ("GNU Emacs %s\n", SDATA (tem));
-         printf ("Copyright (C) 2006 Free Software Foundation, Inc.\n");
+         printf ("%s\n", SDATA(tem2));
          printf ("GNU Emacs comes with ABSOLUTELY NO WARRANTY.\n");
          printf ("You may redistribute copies of Emacs\n");
          printf ("under the terms of the GNU General Public License.\n");
@@ -1193,10 +1200,10 @@ main (argc, argv
       signal (SIGILL, fatal_error_signal);
       signal (SIGTRAP, fatal_error_signal);
 #ifdef SIGUSR1
-      add_user_signal (SIGUSR1, "usr1");
+      add_user_signal (SIGUSR1, "sigusr1");
 #endif
 #ifdef SIGUSR2
-      add_user_signal (SIGUSR2, "usr2");
+      add_user_signal (SIGUSR2, "sigusr2");
 #endif
 #ifdef SIGABRT
       signal (SIGABRT, fatal_error_signal);
@@ -1284,6 +1291,9 @@ main (argc, argv
         faces, and the face implementation uses some symbols as
         face names.  */
       syms_of_xfaces ();
+      /* XXX syms_of_keyboard uses some symbols in keymap.c.  It would
+         be better to arrange things not to have this dependency.  */
+      syms_of_keymap ();
       /* Call syms_of_keyboard before init_window_once because
         keyboard sets up symbols that include some face names that
         the X support will want to use.  This can happen when
@@ -1481,10 +1491,10 @@ main (argc, argv
   /* egetenv is a pretty low-level facility, which may get called in
      many circumstances; it seems flimsy to put off initializing it
      until calling init_callproc.  */
-  set_process_environment ();
+  set_initial_environment ();
   /* AIX crashes are reported in system versions 3.2.3 and 3.2.4
-     if this is not done.  Do it after set_process_environment so that we
-     don't pollute Vprocess_environment.  */
+     if this is not done.  Do it after set_global_environment so that we
+     don't pollute Vglobal_environment.  */
   /* Setting LANG here will defeat the startup locale processing...  */
 #ifdef AIX3_2
   putenv ("LANG=C");
@@ -1555,7 +1565,7 @@ main (argc, argv
 #endif /* CLASH_DETECTION */
       syms_of_indent ();
       syms_of_insdel ();
-      syms_of_keymap ();
+      /* syms_of_keymap (); */
       syms_of_macros ();
       syms_of_marker ();
       syms_of_minibuf ();
@@ -1566,6 +1576,7 @@ main (argc, argv
       syms_of_frame ();
 #endif
       syms_of_syntax ();
+      syms_of_terminal ();
       syms_of_term ();
       syms_of_undo ();
 #ifdef HAVE_SOUND
@@ -1650,13 +1661,7 @@ main (argc, argv
 #endif  /* HAVE_NTGUI */
     }
 
-  if (!noninteractive)
-    {
-#ifdef VMS
-      init_vms_input ();/* init_display calls get_frame_size, that needs this.  */
-#endif /* VMS */
-      init_display (); /* Determine terminal type.  init_sys_modes uses results.  */
-    }
+  init_process (); /* init_display uses add_keyboard_wait_descriptor. */
 #ifndef MAC_OS8
   /* Called before init_window_once for Mac OS Classic.  */
   init_keyboard ();    /* This too must precede init_sys_modes.  */
@@ -1664,7 +1669,13 @@ main (argc, argv
 #ifdef VMS
   init_vmsproc ();     /* And this too.  */
 #endif /* VMS */
-  init_sys_modes ();   /* Init system terminal modes (RAW or CBREAK, etc.).  */
+  if (!noninteractive)
+    {
+#ifdef VMS
+      init_vms_input ();/* init_display calls get_tty_size, that needs this.  */
+#endif /* VMS */
+      init_display (); /* Determine terminal type.  Calls init_sys_modes.  */
+    }
   init_fns ();
   init_xdisp ();
 #ifdef HAVE_WINDOW_SYSTEM
@@ -1677,7 +1688,6 @@ main (argc, argv
 #ifdef VMS
   init_vmsfns ();
 #endif /* VMS */
-  init_process ();
 #ifdef HAVE_SOUND
   init_sound ();
 #endif
@@ -1719,8 +1729,9 @@ main (argc, argv
   /* Set up for profiling.  This is known to work on FreeBSD,
      GNU/Linux and MinGW.  It might work on some other systems too.
      Give it a try and tell us if it works on your system.  To compile
-     for profiling use something like:
-       `make CFLAGS="-pg -g -O -DPROFILING=1'.  */
+     for profiling, add -pg to the switches your platform uses in
+     CFLAGS and LDFLAGS.  For example:
+       `make CFLAGS="-pg -g -O -DPROFILING=1" LDFLAGS="-pg -g"'.  */
 #if defined (__FreeBSD__) || defined (GNU_LINUX) || defined(__MINGW32__)
 #ifdef PROFILING
   if (initialized)
@@ -2089,15 +2100,14 @@ shut_down_emacs (sig, no_x, stuff)
     if (EMACS_GET_TTY_PGRP (0, &tpgrp) != -1
        && tpgrp == pgrp)
       {
-       fflush (stdout);
-       reset_sys_modes ();
+       reset_all_sys_modes ();
        if (sig && sig != SIGTERM)
          fprintf (stderr, "Fatal error (%d)", sig);
       }
   }
 #else
   fflush (stdout);
-  reset_sys_modes ();
+  reset_all_sys_modes ();
 #endif
 
   stuff_buffered_input (stuff);
@@ -2119,9 +2129,9 @@ shut_down_emacs (sig, no_x, stuff)
 #if 0 /* This triggers a bug in XCloseDisplay and is not needed.  */
 #ifdef HAVE_X_WINDOWS
   /* It's not safe to call intern here.  Maybe we are crashing.  */
-  if (!noninteractive && SYMBOLP (Vwindow_system)
-      && SCHARS (SYMBOL_NAME (Vwindow_system)) == 1
-      && SREF (SYMBOL_NAME (Vwindow_system), 0) == 'x'
+  if (!noninteractive && SYMBOLP (Vinitial_window_system)
+      && SCHARS (SYMBOL_NAME (Vinitial_window_system)) == 1
+      && SREF (SYMBOL_NAME (Vinitial_window_system), 0) == 'x'
       && ! no_x)
     Fx_close_current_connection ();
 #endif /* HAVE_X_WINDOWS */
@@ -2467,9 +2477,6 @@ see `kill-emacs-query-functions' instead.
 The hook is not run in batch mode, i.e., if `noninteractive' is non-nil.  */);
   Vkill_emacs_hook = Qnil;
 
-  empty_string = build_string ("");
-  staticpro (&empty_string);
-
   DEFVAR_INT ("emacs-priority", &emacs_priority,
              doc: /* Priority for Emacs to run at.
 This value is effective only if set before Emacs is dumped,
@@ -2480,7 +2487,8 @@ before you compile Emacs, to enable the code for this feature.  */);
   emacs_priority = 0;
 
   DEFVAR_LISP ("path-separator", &Vpath_separator,
-              doc: /* The directory separator in search paths, as a string.  */);
+              doc: /* String containing the character that separates directories in
+search paths, such as PATH and other similar environment variables.  */);
   {
     char c = SEPCHAR;
     Vpath_separator = make_string (&c, 1);