]> code.delx.au - gnu-emacs/blobdiff - src/emacs.c
Merge from emacs--devo--0
[gnu-emacs] / src / emacs.c
index e9fb4e3cb859782cfb166ac5c4c288cb1cd94e55..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,
@@ -134,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;
@@ -304,7 +304,7 @@ Display options:\n\
                                   used for debugging Emacs\n\
 --border-color, -bd COLOR       main border color\n\
 --border-width, -bw WIDTH       width of main border\n\
---color, --color=MODE           color mode for character terminals;\n\
+--color, --color=MODE           override color mode for character terminals;\n\
                                   MODE defaults to `auto', and can also\n\
                                   be `never', `auto', `always',\n\
                                   or a mode name like `ansi8'\n\
@@ -362,39 +362,6 @@ pthread_t main_thread;
 #endif
 
 
-#ifdef SIGUSR1
-SIGTYPE
-handle_USR1_signal (sig)
-     int sig;
-{
-  struct input_event buf;
-
-  SIGNAL_THREAD_CHECK (sig);
-  bzero (&buf, sizeof buf);
-  buf.kind = USER_SIGNAL_EVENT;
-  buf.frame_or_window = selected_frame;
-
-  kbd_buffer_store_event (&buf);
-}
-#endif /* SIGUSR1 */
-
-#ifdef SIGUSR2
-SIGTYPE
-handle_USR2_signal (sig)
-     int sig;
-{
-  struct input_event buf;
-
-  SIGNAL_THREAD_CHECK (sig);
-  bzero (&buf, sizeof buf);
-  buf.kind = USER_SIGNAL_EVENT;
-  buf.code = 1;
-  buf.frame_or_window = selected_frame;
-
-  kbd_buffer_store_event (&buf);
-}
-#endif /* SIGUSR2 */
-
 /* Handle bus errors, invalid instruction, etc.  */
 SIGTYPE
 fatal_error_signal (sig)
@@ -789,7 +756,7 @@ void (*__malloc_initialize_hook) () = malloc_initialize_hook;
 
 
 #define REPORT_EMACS_BUG_ADDRESS "bug-gnu-emacs@gnu.org"
-#define REPORT_EMACS_BUG_PRETEST_ADDRESS "multi-tty@lists.fnord.hu"
+#define REPORT_EMACS_BUG_PRETEST_ADDRESS "emacs-pretest-bug@gnu.org"
 
 /* This function is used to determine an address to which bug report should
    be sent.  */
@@ -890,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");
@@ -1227,10 +1200,10 @@ main (argc, argv
       signal (SIGILL, fatal_error_signal);
       signal (SIGTRAP, fatal_error_signal);
 #ifdef SIGUSR1
-      signal (SIGUSR1, handle_USR1_signal);
-#ifdef SIGUSR2
-      signal (SIGUSR2, handle_USR2_signal);
+      add_user_signal (SIGUSR1, "sigusr1");
 #endif
+#ifdef SIGUSR2
+      add_user_signal (SIGUSR2, "sigusr2");
 #endif
 #ifdef SIGABRT
       signal (SIGABRT, fatal_error_signal);
@@ -1518,7 +1491,7 @@ 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_global_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_global_environment so that we
      don't pollute Vglobal_environment.  */
@@ -1753,16 +1726,22 @@ main (argc, argv
 #endif
     }
 
-  /* Set up for profiling.  This is known to work on FreeBSD and
-     GNU/Linux.  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'.  */
-#if defined (__FreeBSD__) || defined (__linux)
+  /* 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, 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)
     {
       extern void _mcleanup ();
+#ifdef __MINGW32__
+      extern unsigned char etext asm ("etext");
+#else
       extern char etext;
+#endif
       extern void safe_bcopy ();
       extern void dump_opcode_frequencies ();
 
@@ -2050,7 +2029,7 @@ sort_args (argc, argv)
 DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 1, "P",
        doc: /* Exit the Emacs job and kill it.
 If ARG is an integer, return ARG as the exit program code.
-If ARG is a  string, stuff it as keyboard input.
+If ARG is a string, stuff it as keyboard input.
 
 The value of `kill-emacs-hook', if not void,
 is a list of functions (of no args),
@@ -2133,6 +2112,9 @@ shut_down_emacs (sig, no_x, stuff)
 
   stuff_buffered_input (stuff);
 
+#ifdef subprocesses
+  inhibit_sentinels = 1;
+#endif
   kill_buffer_processes (Qnil);
   Fdo_auto_save (Qt, Qnil);
 
@@ -2235,7 +2217,7 @@ You must run Emacs in batch mode in order to dump it.  */)
   if (! noninteractive)
     error ("Dumping Emacs works only in batch mode");
 
-#ifdef __linux__
+#ifdef GNU_LINUX
   if (heap_bss_diff > MAX_HEAP_BSS_DIFF)
     {
       fprintf (stderr, "**************************************************\n");
@@ -2247,7 +2229,7 @@ You must run Emacs in batch mode in order to dump it.  */)
       fprintf (stderr, "exec-shield in etc/PROBLEMS for more information.\n");
       fprintf (stderr, "**************************************************\n");
     }
-#endif /* __linux__ */
+#endif /* GNU_LINUX */
 
   /* Bind `command-line-processed' to nil before dumping,
      so that the dumped Emacs will process its command line
@@ -2467,7 +2449,8 @@ Special values:
   `ms-dos'      compiled as an MS-DOS application.
   `windows-nt'  compiled as a native W32 application.
   `cygwin'      compiled using the Cygwin library.
-  `vax-vms' or `axp-vms': compiled for a (Open)VMS system.
+  `vax-vms' or
+  `axp-vms'     compiled for a (Open)VMS system.
 Anything else indicates some sort of Unix system.  */);
   Vsystem_type = intern (SYSTEM_TYPE);
 
@@ -2494,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,
@@ -2507,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);