]> code.delx.au - gnu-emacs/blobdiff - src/emacs.c
(Fset_char_table_parent): Fix previous change.
[gnu-emacs] / src / emacs.c
index 296a4ac317bc815a358112c9f9323cb4f9e73d16..4f0d70cbbe1c8e806f9fb15ffa1bd51bff7cf675 100644 (file)
@@ -110,9 +110,9 @@ int display_arg;
    Tells GC how to save a copy of the stack.  */
 char *stack_bottom;
 
-#ifdef HAVE_X_WINDOWS
+#ifdef HAVE_WINDOW_SYSTEM
 extern Lisp_Object Vwindow_system;
-#endif /* HAVE_X_WINDOWS */
+#endif /* HAVE_WINDOW_SYSTEM */
 
 extern Lisp_Object Vauto_save_list_file_name;
 
@@ -218,6 +218,11 @@ init_cmdargs (argc, argv, skip_args)
        Vinvocation_directory = Ffile_name_directory (found);
     }
 
+  if (!NILP (Vinvocation_directory)
+      && NILP (Ffile_name_absolute_p (Vinvocation_directory)))
+    /* Emacs was started with relative path, like ./emacs  */
+    Vinvocation_directory = Fexpand_file_name (Vinvocation_directory, Qnil);
+
   Vinstallation_directory = Qnil;
 
   if (!NILP (Vinvocation_directory))
@@ -304,9 +309,9 @@ DEFUN ("invocation-directory", Finvocation_directory, Sinvocation_directory,
 \f
 #ifdef VMS
 #ifdef LINK_CRTL_SHARE
-#ifdef SHAREABLE_LIB_BUG
+#ifdef SHARABLE_LIB_BUG
 extern noshare char **environ;
-#endif /* SHAREABLE_LIB_BUG */
+#endif /* SHARABLE_LIB_BUG */
 #endif /* LINK_CRTL_SHARE */
 #endif /* VMS */
 
@@ -414,6 +419,10 @@ main (argc, argv, envp)
   extern int errno;
   extern sys_nerr;
 
+#ifdef LINUX_SBRK_BUG
+  __sbrk (1);
+#endif
+
   sort_args (argc, argv);
 
   if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args))
@@ -467,7 +476,7 @@ main (argc, argv, envp)
   }
 
 #ifdef LINK_CRTL_SHARE
-#ifdef SHAREABLE_LIB_BUG
+#ifdef SHARABLE_LIB_BUG
   /* Bletcherous shared libraries! */
   if (!stdin)
     stdin = fdopen (0, "r");
@@ -477,7 +486,7 @@ main (argc, argv, envp)
     stderr = fdopen (2, "w");
   if (!environ)
     environ = envp;
-#endif /* SHAREABLE_LIB_BUG */
+#endif /* SHARABLE_LIB_BUG */
 #endif /* LINK_CRTL_SHARE */
 #endif /* VMS */
 
@@ -551,7 +560,7 @@ main (argc, argv, envp)
            exit (1);
          }
        fprintf (stderr, "Using %s\n", term);
-#ifdef HAVE_X_WINDOWS
+#ifdef HAVE_WINDOW_SYSTEM
        inhibit_window_system = 1; /* -t => -nw */
 #endif
       }
@@ -570,9 +579,9 @@ main (argc, argv, envp)
       printf ("\
 Usage: %s [-t term] [--terminal term]  [-nw] [--no-windows]  [--batch]\n\
       [-q] [--no-init-file]  [-u user] [--user user]  [--debug-init]\n\
-\(Arguments above this line must be first; those below may be in any order)\n\
+      [--version] [--no-site-file]\n\
       [-f func] [--funcall func]  [-l file] [--load file]  [--insert file]\n\
-      file-to-visit  [--kill]\n", argv[0]);
+      [+linenum] file-to-visit  [--kill]\n", argv[0]);
       exit (0);
     }
 
@@ -611,7 +620,7 @@ Usage: %s [-t term] [--terminal term]  [-nw] [--no-windows]  [--batch]\n\
     /* Change --display to -d, when its arg is separate.  */
     else if (displayname != 0 && skip_args > count_before
             && argv[count_before + 1][1] == '-')
-      argv[count_before] = "-d";
+      argv[count_before + 1] = "-d";
 
     /* Don't actually discard this arg.  */
     skip_args = count_before;
@@ -742,6 +751,12 @@ Usage: %s [-t term] [--terminal term]  [-nw] [--no-windows]  [--batch]\n\
   init_dosfns ();
   /* Set defaults for several environment variables.  */
   if (initialized) init_environment (argc, argv, skip_args);
+  else init_gettimeofday ();
+#endif
+
+#ifdef WINDOWSNT
+  /* Initialize environment from registry settings.  */
+  init_environment ();
 #endif
 
   /* egetenv is a pretty low-level facility, which may get called in
@@ -850,16 +865,24 @@ Usage: %s [-t term] [--terminal term]  [-nw] [--no-windows]  [--batch]\n\
 #ifdef HAVE_X11
       syms_of_xselect ();
 #endif
-#ifdef HAVE_X_MENU
-      syms_of_xmenu ();
-#endif /* HAVE_X_MENU */
 #endif /* HAVE_X_WINDOWS */
 
 #if defined (MSDOS) && !defined (HAVE_X_WINDOWS)
       syms_of_xfaces ();
-      syms_of_xmenu ();
 #endif
 
+#ifdef HAVE_MENUS
+      syms_of_xmenu ();
+#endif /* HAVE_MENUS */
+
+#ifdef HAVE_NTGUI
+      syms_of_win32term ();
+      syms_of_win32fns ();
+      syms_of_win32faces ();
+      syms_of_win32select ();
+      syms_of_win32menu ();
+#endif /* HAVE_NTGUI */
+
 #ifdef SYMS_SYSTEM
       SYMS_SYSTEM;
 #endif
@@ -906,14 +929,14 @@ Usage: %s [-t term] [--terminal term]  [-nw] [--no-windows]  [--batch]\n\
 
   initialized = 1;
 
-#if defined (sun) || defined (LOCALTIME_CACHE)
-  /* sun's localtime has a bug.  it caches the value of the time
+#ifdef LOCALTIME_CACHE
+  /* Some versions of localtime have a bug.  They cache the value of the time
      zone rather than looking it up every time.  Since localtime() is
      called to bolt the undumping time into the undumped emacs, this
      results in localtime ignoring the TZ environment variable.
      This flushes the new TZ value into localtime. */
   tzset ();
-#endif /* defined (sun) || defined (LOCALTIME_CACHE) */
+#endif /* defined (LOCALTIME_CACHE) */
 
   /* Enter editor command loop.  This never returns.  */
   Frecursive_edit ();
@@ -983,6 +1006,7 @@ struct standard_args standard_args[] =
   { "-load", 0, 0, 1 },
   { "-f", "--funcall", 0, 1 },
   { "-funcall", 0, 0, 1 },
+  { "-eval", "--eval", 0, 1 },
   { "-insert", "--insert", 0, 1 },
   /* This should be processed after ordinary file name args and the like.  */
   { "-kill", "--kill", -10, 0 },
@@ -1075,7 +1099,7 @@ sort_args (argc, argv)
   while (to < argc)
     {
       int best = -1;
-      int best_priority = -2;
+      int best_priority = -9999;
 
       /* Find the highest priority remaining option.
         If several have equal priority, take the first of them.  */
@@ -1237,14 +1261,14 @@ shut_down_emacs (sig, no_x, stuff)
 DEFUN ("dump-emacs-data", Fdump_emacs_data, Sdump_emacs_data, 1, 1, 0,
   "Dump current state of Emacs into data file FILENAME.\n\
 This function exists on systems that use HAVE_SHM.")
-  (intoname)
-     Lisp_Object intoname;
+  (filename)
+     Lisp_Object filename;
 {
   extern char my_edata[];
   Lisp_Object tem;
 
-  CHECK_STRING (intoname, 0);
-  intoname = Fexpand_file_name (intoname, Qnil);
+  CHECK_STRING (filename, 0);
+  filename = Fexpand_file_name (filename, Qnil);
 
   tem = Vpurify_flag;
   Vpurify_flag = Qnil;
@@ -1255,7 +1279,7 @@ This function exists on systems that use HAVE_SHM.")
 #ifndef SYSTEM_MALLOC
   memory_warnings (my_edata, malloc_warning);
 #endif
-  map_out_data (XSTRING (intoname)->data);
+  map_out_data (XSTRING (filename)->data);
 
   Vpurify_flag = tem;
 
@@ -1272,19 +1296,19 @@ This is used in the file `loadup.el' when building Emacs.\n\
 Bind `command-line-processed' to nil before dumping,\n\
 if you want the dumped Emacs to process its command line\n\
 and announce itself normally when it is run.")
-  (intoname, symname)
-     Lisp_Object intoname, symname;
+  (filename, symfile)
+     Lisp_Object filename, symfile;
 {
   extern char my_edata[];
   Lisp_Object tem;
 
-  CHECK_STRING (intoname, 0);
-  intoname = Fexpand_file_name (intoname, Qnil);
-  if (!NILP (symname))
+  CHECK_STRING (filename, 0);
+  filename = Fexpand_file_name (filename, Qnil);
+  if (!NILP (symfile))
     {
-      CHECK_STRING (symname, 0);
-      if (XSTRING (symname)->size)
-       symname = Fexpand_file_name (symname, Qnil);
+      CHECK_STRING (symfile, 0);
+      if (XSTRING (symfile)->size)
+       symfile = Fexpand_file_name (symfile, Qnil);
     }
 
   tem = Vpurify_flag;
@@ -1292,7 +1316,7 @@ and announce itself normally when it is run.")
 
   fflush (stdout);
 #ifdef VMS
-  mapout_data (XSTRING (intoname)->data);
+  mapout_data (XSTRING (filename)->data);
 #else
   /* Tell malloc where start of impure now is */
   /* Also arrange for warnings when nearly out of space.  */
@@ -1303,8 +1327,8 @@ and announce itself normally when it is run.")
   memory_warnings (my_edata, malloc_warning);
 #endif /* not WINDOWSNT */
 #endif
-  unexec (XSTRING (intoname)->data,
-         !NILP (symname) ? XSTRING (symname)->data : 0, my_edata, 0, 0);
+  unexec (XSTRING (filename)->data,
+         !NILP (symfile) ? XSTRING (symfile)->data : 0, my_edata, 0, 0);
 #endif /* not VMS */
 
   Vpurify_flag = tem;
@@ -1342,7 +1366,8 @@ decode_env_path (evarname, defalt)
     {
       p = index (path, SEPCHAR);
       if (!p) p = path + strlen (path);
-      lpath = Fcons (p - path ? make_string (path, p - path) : Qnil,
+      lpath = Fcons (p - path ? make_string (path, p - path)
+                    : build_string ("."),
                     lpath);
       if (*p)
        path = p + 1;