(memory_warning_signal): Call force_auto_save_soon.
[bpt/emacs.git] / src / emacs.c
index d0bcd1c..56d4ecf 100644 (file)
@@ -94,7 +94,7 @@ int inhibit_window_system;
    priority; Those functions have their own extern declaration.  */
 int emacs_priority;
 
-#ifdef BSD
+#ifdef BSD_PGRPS
 /* See sysdep.c.  */
 extern int inherited_pgroup;
 #endif
@@ -175,6 +175,9 @@ memory_warning_signal (sig)
   signal (sig, memory_warning_signal);
 
   malloc_warning ("Operating system warns that virtual memory is running low.\n");
+
+  /* It might be unsafe to call do_auto_save now.  */
+  force_auto_save_soon ();
 }
 #endif
 \f
@@ -210,57 +213,39 @@ init_cmdargs (argc, argv, skip_args)
       name = Fexpand_file_name (Vinvocation_name, dir);
       while (1)
        {
-         Lisp_Object tem, lisp_exists, lib_src_exists;
+         Lisp_Object tem, lib_src_exists;
          Lisp_Object etc_exists, info_exists;
 
-         /* See if dir contains subdirs for use by Emacs.  */
-         tem = Fexpand_file_name (build_string ("lisp"), dir);
-         lisp_exists = Ffile_exists_p (tem);
-         if (!NILP (lisp_exists))
+         /* See if dir contains subdirs for use by Emacs.
+            Check for the ones that would exist in a build directory,
+            not including lisp and info.  */
+         tem = Fexpand_file_name (build_string ("lib-src"), dir);
+         lib_src_exists = Ffile_exists_p (tem);
+         if (!NILP (lib_src_exists))
            {
-             tem = Fexpand_file_name (build_string ("lib-src"), dir);
-             lib_src_exists = Ffile_exists_p (tem);
-             if (!NILP (lib_src_exists))
+             tem = Fexpand_file_name (build_string ("etc"), dir);
+             etc_exists = Ffile_exists_p (tem);
+             if (!NILP (etc_exists))
                {
-                 tem = Fexpand_file_name (build_string ("etc"), dir);
-                 etc_exists = Ffile_exists_p (tem);
-                 if (!NILP (etc_exists))
-                   {
-                     tem = Fexpand_file_name (build_string ("info"), dir);
-                     info_exists = Ffile_exists_p (tem);
-                     if (!NILP (info_exists))
-                       {
-                         Vinstallation_directory
-                           = Ffile_name_as_directory (dir);
-                         break;
-                       }
-                   }
+                 Vinstallation_directory
+                   = Ffile_name_as_directory (dir);
+                 break;
                }
            }
 
          /* See if dir's parent contains those subdirs.  */
-         tem = Fexpand_file_name (build_string ("../lisp"), dir);
-         lisp_exists = Ffile_exists_p (tem);
-         if (!NILP (lisp_exists))
+         tem = Fexpand_file_name (build_string ("../lib-src"), dir);
+         lib_src_exists = Ffile_exists_p (tem);
+         if (!NILP (lib_src_exists))
            {
-             tem = Fexpand_file_name (build_string ("../lib-src"), dir);
-             lib_src_exists = Ffile_exists_p (tem);
-             if (!NILP (lib_src_exists))
+             tem = Fexpand_file_name (build_string ("../etc"), dir);
+             etc_exists = Ffile_exists_p (tem);
+             if (!NILP (etc_exists))
                {
-                 tem = Fexpand_file_name (build_string ("../etc"), dir);
-                 etc_exists = Ffile_exists_p (tem);
-                 if (!NILP (etc_exists))
-                   {
-                     tem = Fexpand_file_name (build_string ("../info"), dir);
-                     info_exists = Ffile_exists_p (tem);
-                     if (!NILP (info_exists))
-                       {
-                         tem = Fexpand_file_name (build_string (".."), dir);
-                         Vinstallation_directory
-                           = Ffile_name_as_directory (tem);
-                         break;
-                       }
-                   }
+                 tem = Fexpand_file_name (build_string (".."), dir);
+                 Vinstallation_directory
+                   = Ffile_name_as_directory (tem);
+                 break;
                }
            }
 
@@ -473,6 +458,10 @@ main (argc, argv, envp)
   setuid (getuid ());
 #endif /* PRIO_PROCESS */
 
+#ifdef EXTRA_INITIALIZE
+  EXTRA_INITIALIZE;
+#endif
+
   inhibit_window_system = 0;
 
   /* Handle the -t switch, which specifies filename to use as terminal */
@@ -1035,13 +1024,23 @@ expect to be able to interact with the user.");
     "Priority for Emacs to run at.\n\
 This value is effective only if set before Emacs is dumped,\n\
 and only if the Emacs executable is installed with setuid to permit\n\
-it to change priority.  (Emacs sets its uid back to the real uid.)");
+it to change priority.  (Emacs sets its uid back to the real uid.)\n\
+Currently, you need to define PRIO_PROCESS in `config.h'\n\
+before you compile Emacs, to enable the code for this feature.");
   emacs_priority = 0;
 
-  staticpro (&Vinstallation_directory);
-  Vinstallation_directory = Qnil;
+  DEFVAR_LISP ("invocation-name", &Vinvocation_name,
+    "The program name that was used to run Emacs.\n\
+Any directory names are omitted.");
 
-  /* These have already been set, in init_cmdargs, so don't set them here.  */
-  staticpro (&Vinvocation_name);
-  staticpro (&Vinvocation_directory);
+  DEFVAR_LISP ("invocation-directory", &Vinvocation_directory,
+    "The directory in which the Emacs executable was found, to run it.\n\
+The value is nil if that directory's name is not known.");
+
+  DEFVAR_LISP ("installation-directory", &Vinstallation_directory,
+    "A directory within which to look for the `lib-src' and `etc' directories.\n\
+This is non-nil when we can't find those directories in their standard\n\
+installed locations, but we can find them\n\
+near where the Emacs executable was found.");
+  Vinstallation_directory = Qnil;
 }