]> code.delx.au - gnu-emacs/blobdiff - src/emacs.c
(make_cursor_line_fully_visible): Handle case of rows
[gnu-emacs] / src / emacs.c
index 7acf3f59e4d30f6469ac8497e27cb0ebecf93bc0..ddb540eb3d10798b96642141de565e026d7e6bf3 100644 (file)
@@ -67,7 +67,18 @@ Boston, MA 02111-1307, USA.  */
 extern void malloc_warning ();
 extern void set_time_zone_rule ();
 extern char *index ();
-extern char *strerror ();
+
+/* Make these values available in GDB, which doesn't see macros.  */
+
+EMACS_INT gdb_valbits = VALBITS;
+EMACS_INT gdb_gctypebits = GCTYPEBITS;
+EMACS_INT gdb_emacs_intbits = sizeof (EMACS_INT) * BITS_PER_CHAR;
+#ifdef DATA_SEG_BITS
+EMACS_INT gdb_data_seg_bits = DATA_SEG_BITS;
+#else
+EMACS_INT  gdb_data_seg_bits = 0;
+#endif
+EMACS_INT PVEC_FLAG = PSEUDOVECTOR_FLAG;
 
 /* Command line args from shell, as list of strings */
 Lisp_Object Vcommand_line_args;
@@ -128,10 +139,10 @@ Lisp_Object Vsystem_configuration_options;
 Lisp_Object Qfile_name_handler_alist;
 
 /* Current and previous system locales for messages and time.  */
-Lisp_Object Vmessages_locale;
-Lisp_Object Vprevious_messages_locale;
-Lisp_Object Vtime_locale;
-Lisp_Object Vprevious_time_locale;
+Lisp_Object Vsystem_messages_locale;
+Lisp_Object Vprevious_system_messages_locale;
+Lisp_Object Vsystem_time_locale;
+Lisp_Object Vprevious_system_time_locale;
 
 /* If non-zero, emacs should not attempt to use an window-specific code,
    but instead should use the virtual terminal under which it was started */
@@ -189,6 +200,79 @@ int initial_argc;
 
 static void sort_args ();
 void syms_of_emacs ();
+
+#define USAGE1 "\
+Usage: %s [OPTION-OR-FILENAME]...\n\
+\n\
+Run Emacs, the extensible, customizable, self-documenting real-time\n\
+display editor.  The recommended way to start Emacs for normal editing\n\
+is with no options at all.\n\
+\n\
+Run M-x info RET m emacs RET m command arguments RET inside Emacs to\n\
+read the main documentation for these command-line arguments.\n\
+\n\
+Initialization options:\n\
+\n\
+--batch                        do not do interactive display; implies -q\n\
+--debug-init           enable Emacs Lisp debugger during init file\n\
+--help                 display this help message and exit\n\
+--multibyte, --no-unibyte   run Emacs in multibyte mode\n\
+--no-init-file, -q         load neither ~/.emacs nor default.el\n\
+--no-shared-memory, -nl            do not use shared memory\n\
+--no-site-file             do not load site-start.el\n\
+--no-windows, -nw          don't communicate with X, ignoring $DISPLAY\n\
+--terminal, -t DEVICE      use DEVICE for terminal I/O\n\
+--unibyte, --no-multibyte   run Emacs in unibyte mode\n\
+--user, -u USER                load ~USER/.emacs instead of your own\n\
+--version              display version information and exit\n\
+\n\
+Action options:\n\
+\n\
+FILE                   visit FILE using find-file\n\
++LINENUM FILE          visit FILE using find-file, then go to line LINENUM\n\
+--directory, -L DIR    add DIR to variable load-path\n\
+--eval EXPR            evaluate Emacs Lisp expression EXPR\n\
+--execute EXPR         evaluate Emacs Lisp expression EXPR\n\
+--find-file FILE       visit FILE\n\
+--funcall, -f FUNC     call Emacs function FUNC with no arguments\n\
+--insert FILE          insert contents of FILE into current buffer\n\
+--kill                 exit without asking for confirmation\n\
+--load, -l FILE                load FILE of Emacs Lisp code using the load function\n\
+--visit FILE           visit FILE\n\
+\n"
+
+#define USAGE2 "\
+Display options:\n\
+\n\
+--background-color, -bg COLOR  window background color\n\
+--border-color, -bd COLOR      main border color\n\
+--border-width, -bw WIDTH      width of main border\n\
+--cursor-color, -cr COLOR      color of the Emacs cursor indicating point\n\
+--display, -d DISPLAY          use X server DISPLAY\n\
+--font, -fn FONT               default font; must be fixed-widthp\n\
+--foreground-color, -fg COLOR  window foreground color\n\
+--geometry, -g GEOMETRY                window geometry\n\
+--iconic                       start Emacs in iconified state\n\
+--icon-type, -i                        use picture of gnu for Emacs icon\n\
+--internal-border, -ib WIDTH   width between text and main border\n\
+--line-spacing, -lsp PIXELS    additional space to put between lines\n\
+--mouse-color, -ms COLOR       mouse cursor color in Emacs window\n\
+--name NAME                    title of main Emacs window\n\
+--reverse-video, -r, -rv       switch foreground and background\n\
+--title, -T, -wn, TITLE                title for Emacs windows\n\
+--vertical-scroll-bars, -vb    enable vertical scroll bars\n\
+--xrm XRESOURCES               set additional X resources\n\
+\n\
+You can generally also specify long option names with a single -; for\n\
+example, -batch as well as --batch.  You can use any unambiguous\n\
+abbreviation for a --option.\n\
+\n\
+Various environment variables and window system resources also affect\n\
+Emacs' operation.  See the main documentation.\n\
+\n\
+Report bugs to bug-gnu-emacs@gnu.org.  First, please see the Bugs\n\
+section of the Emacs manual or the file BUGS.\n"
+
 \f
 /* Signal code for the fatal signal that was received */
 int fatal_error_code;
@@ -283,7 +367,12 @@ memory_warning_signal (sig)
    MSDOS has its own definition on msdos.c  */
 
 #if ! defined (DOS_NT) && ! defined (NO_ABORT)
-void
+
+#ifndef ABORT_RETURN_TYPE
+#define ABORT_RETURN_TYPE void
+#endif
+
+ABORT_RETURN_TYPE
 abort ()
 {
   kill (getpid (), SIGABRT);
@@ -606,6 +695,9 @@ main (argc, argv, envp)
      char **argv;
      char **envp;
 {
+#if GC_MARK_STACK
+  Lisp_Object dummy;
+#endif
   char stack_bottom_variable;
   int do_initial_setlocale;
   int skip_args = 0;
@@ -616,6 +708,11 @@ main (argc, argv, envp)
 #endif
   int no_loadup = 0;
 
+#if GC_MARK_STACK
+  extern Lisp_Object *stack_base;
+  stack_base = &dummy;
+#endif
+
 #ifdef LINUX_SBRK_BUG
   __sbrk (1);
 #endif
@@ -853,15 +950,8 @@ main (argc, argv, envp)
   /* Handle the --help option, which gives a usage message..  */
   if (argmatch (argv, argc, "-help", "--help", 3, NULL, &skip_args))
     {
-      printf ("\
-Usage: %s [--batch]  [-t term] [--terminal term]\n\
-      [-d display] [--display display]  [-nw] [--no-windows]\n\
-      [-q] [--no-init-file]  [-u user] [--user user]  [--debug-init]\n\
-      [--unibyte] [--multibyte] [--version] [--no-site-file]\n\
-      [-f func] [--funcall func]  [-l file] [--load file]  [--eval expr]\n\
-      [--insert file] [+linenum] file-to-visit  [--kill]\n\
-Report bugs to bug-gnu-emacs@gnu.org.  First, please see\n\
-the Bugs section of the Emacs manual or the file BUGS.\n", argv[0]);
+      printf (USAGE1, argv[0]);
+      printf (USAGE2);
       exit (0);
     }
 
@@ -880,9 +970,7 @@ the Bugs section of the Emacs manual or the file BUGS.\n", argv[0]);
 #endif
     }
 
-#ifdef POSIX_SIGNALS
   init_signals ();
-#endif
 
   /* Don't catch SIGHUP if dumping.  */
   if (1
@@ -1005,9 +1093,7 @@ the Bugs section of the Emacs manual or the file BUGS.\n", argv[0]);
         function creates Vterminal_frame.  Termcap frames now use
         faces, and the face implementation uses some symbols as
         face names.  */
-#ifndef HAVE_NTGUI
       syms_of_xfaces ();
-#endif
 
       init_window_once ();     /* Init the window system */
       init_fileio_once ();     /* Must precede any path manipulation.  */
@@ -1018,8 +1104,8 @@ the Bugs section of the Emacs manual or the file BUGS.\n", argv[0]);
   if (do_initial_setlocale)
     {
       fixup_locale ();
-      Vmessages_locale = Vprevious_messages_locale;
-      Vtime_locale = Vprevious_time_locale;
+      Vsystem_messages_locale = Vprevious_system_messages_locale;
+      Vsystem_time_locale = Vprevious_system_time_locale;
     }
 
   init_eval ();
@@ -1028,6 +1114,7 @@ the Bugs section of the Emacs manual or the file BUGS.\n", argv[0]);
 #ifdef CLASH_DETECTION
   init_filelock ();;
 #endif
+  init_atimer ();
   running_asynch_code = 0;
 
   /* Handle --unibyte and the EMACS_UNIBYTE envvar,
@@ -1093,7 +1180,7 @@ the Bugs section of the Emacs manual or the file BUGS.\n", argv[0]);
     }
 
   no_loadup
-    = !argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args);
+    = argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args);
 
 
 #ifdef HAVE_X_WINDOWS
@@ -1174,7 +1261,8 @@ the Bugs section of the Emacs manual or the file BUGS.\n", argv[0]);
   /* 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.  */
-#ifdef AIX
+  /* Setting LANG here will defeat the startup locale processing...  */
+#ifdef AIX3_2
   putenv ("LANG=C");
 #endif
 
@@ -1253,8 +1341,8 @@ the Bugs section of the Emacs manual or the file BUGS.\n", argv[0]);
       syms_of_sound ();
 #endif
 
-      /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */
       syms_of_textprop ();
+      syms_of_composite ();
 #ifdef VMS
       syms_of_vmsproc ();
 #endif /* VMS */
@@ -1279,7 +1367,6 @@ the Bugs section of the Emacs manual or the file BUGS.\n", argv[0]);
 #ifdef HAVE_NTGUI
       syms_of_w32term ();
       syms_of_w32fns ();
-      syms_of_w32faces ();
       syms_of_w32select ();
       syms_of_w32menu ();
       syms_of_fontset ();
@@ -1323,9 +1410,7 @@ the Bugs section of the Emacs manual or the file BUGS.\n", argv[0]);
   init_xdisp ();
   init_macros ();
   init_editfns ();
-#ifdef LISP_FLOAT_TYPE
   init_floatfns ();
-#endif
 #ifdef VMS
   init_vmsfns ();
 #endif /* VMS */
@@ -1379,6 +1464,8 @@ the Bugs section of the Emacs manual or the file BUGS.\n", argv[0]);
       extern void _mcleanup ();       
       extern char etext;
       extern void safe_bcopy ();
+      extern void dump_opcode_frequencies ();
+
       atexit (_mcleanup);
       /* This uses safe_bcopy because that function comes first in the
         Emacs executable.  It might be better to use something that
@@ -1484,8 +1571,10 @@ struct standard_args standard_args[] =
   { "-f", "--funcall", 0, 1 },
   { "-funcall", 0, 0, 1 },
   { "-eval", "--eval", 0, 1 },
+  { "-execute", "--execute", 0, 1 },
   { "-find-file", "--find-file", 0, 1 },
   { "-visit", "--visit", 0, 1 },
+  { "-file", "--file", 0, 1 },
   { "-insert", "--insert", 0, 1 },
   /* This should be processed after ordinary file name args and the like.  */
   { "-kill", "--kill", -10, 0 },
@@ -1892,46 +1981,44 @@ You must run Emacs in batch mode in order to dump it.")
 void
 fixup_locale ()
 {
-  char *l;
-
   /* The Emacs Lisp reader needs LC_NUMERIC to be "C",
      so that numbers are read and printed properly for Emacs Lisp.  */
   setlocale (LC_NUMERIC, "C");
-
-#ifdef LC_MESSAGES
-  l = setlocale (LC_MESSAGES, (char *) 0);
-  Vprevious_messages_locale = l ? build_string (l) : Qnil;
-#endif
-  l = setlocale (LC_TIME, (char *) 0);
-  Vprevious_time_locale = l ? build_string (l) : Qnil;
 }
 
+/* Set system locale CATEGORY, with previous locale *PLOCALE, to
+   DESIRED_LOCALE.  */
 static void
 synchronize_locale (category, plocale, desired_locale)
      int category;
      Lisp_Object *plocale;
      Lisp_Object desired_locale;
 {
-  if (STRINGP (desired_locale)
-      && (NILP (*plocale) || NILP (Fstring_equal (*plocale, desired_locale)))
-      && setlocale (category, XSTRING (desired_locale)->data))
-    *plocale = desired_locale;
+  if (! EQ (*plocale, desired_locale))
+    {
+      *plocale = desired_locale;
+      setlocale (category, (STRINGP (desired_locale)
+                           ? (char *)(XSTRING (desired_locale)->data)
+                           : ""));
+    }
 }
 
-/* Set system time locale to match Vtime_locale, if possible.  */
+/* Set system time locale to match Vsystem_time_locale, if possible.  */
 void
-synchronize_time_locale ()
+synchronize_system_time_locale ()
 {
-  synchronize_locale (LC_TIME, &Vprevious_time_locale, Vtime_locale);
+  synchronize_locale (LC_TIME, &Vprevious_system_time_locale,
+                     Vsystem_time_locale);
 }
 
-/* Set system messages locale to match Vmessages_locale, if possible.  */
+/* Set system messages locale to match Vsystem_messages_locale, if
+   possible.  */
 void
-synchronize_messages_locale ()
+synchronize_system_messages_locale ()
 {
 #ifdef LC_MESSAGES
-  synchronize_locale (LC_MESSAGES, &Vprevious_messages_locale,
-                     Vmessages_locale);
+  synchronize_locale (LC_MESSAGES, &Vprevious_system_messages_locale,
+                     Vsystem_messages_locale);
 #endif
 }
 #endif /* HAVE_SETLOCALE */
@@ -2081,19 +2168,20 @@ installed locations, but we can find them\n\
 near where the Emacs executable was found.");
   Vinstallation_directory = Qnil;
 
-  DEFVAR_LISP ("messages-locale", &Vmessages_locale,
+  DEFVAR_LISP ("system-messages-locale", &Vsystem_messages_locale,
     "System locale for messages.");
-  Vmessages_locale = Qnil;
+  Vsystem_messages_locale = Qnil;
 
-  DEFVAR_LISP ("previous-messages-locale", &Vprevious_messages_locale,
+  DEFVAR_LISP ("previous-system-messages-locale",
+    &Vprevious_system_messages_locale,
     "Most recently used system locale for messages.");
-  Vprevious_messages_locale = Qnil;
+  Vprevious_system_messages_locale = Qnil;
 
-  DEFVAR_LISP ("time-locale", &Vtime_locale,
+  DEFVAR_LISP ("system-time-locale", &Vsystem_time_locale,
     "System locale for time.");
-  Vtime_locale = Qnil;
+  Vsystem_time_locale = Qnil;
 
-  DEFVAR_LISP ("previous-time-locale", &Vprevious_time_locale,
+  DEFVAR_LISP ("previous-system-time-locale", &Vprevious_system_time_locale,
     "Most recently used system locale for time.");
-  Vprevious_time_locale = Qnil;
+  Vprevious_system_time_locale = Qnil;
 }