plist module
[bpt/emacs.git] / src / emacs.c
index 93b4598..d4611f8 100644 (file)
@@ -107,6 +107,10 @@ extern void moncontrol (int mode);
 #include <sys/personality.h>
 #endif
 
+Lisp_Object symbol_module;
+Lisp_Object function_module;
+Lisp_Object plist_module;
+
 static const char emacs_version[] = PACKAGE_VERSION;
 static const char emacs_copyright[] = COPYRIGHT;
 static const char emacs_bugreport[] = PACKAGE_BUGREPORT;
@@ -390,7 +394,7 @@ init_cmdargs (int argc, char **argv, int skip_args, char *original_pwd)
 {
   register int i;
   Lisp_Object name, dir, handler;
-  ptrdiff_t count = SPECPDL_INDEX ();
+  dynwind_begin ();
   Lisp_Object raw_name;
 
   initial_argv = argv;
@@ -549,7 +553,7 @@ init_cmdargs (int argc, char **argv, int skip_args, char *original_pwd)
          = Fcons (build_unibyte_string (argv[i]), Vcommand_line_args);
     }
 
-  unbind_to (count, Qnil);
+  dynwind_end ();
 }
 
 DEFUN ("invocation-name", Finvocation_name, Sinvocation_name, 0, 0, 0,
@@ -696,9 +700,19 @@ close_output_streams (void)
      _exit (EXIT_FAILURE);
 }
 
-/* ARGSUSED */
+static int main2 (void *, int, char **);
+
 int
 main (int argc, char **argv)
+{
+  /* Override Guile's libgc configuration. */
+  xputenv ("GC_ALL_INTERIOR_POINTERS=1");
+  scm_boot_guile (argc, argv, main2, NULL);
+}
+
+/* ARGSUSED */
+static int
+main2 (void *ignore, int argc, char **argv)
 {
   bool do_initial_setlocale;
   bool dumping;
@@ -766,10 +780,6 @@ main (int argc, char **argv)
 
   atexit (close_output_streams);
 
-  /* Override Guile's libgc configuration. */
-  xputenv ("GC_ALL_INTERIOR_POINTERS=1");
-  scm_init_guile ();
-
   sort_args (argc, argv);
   argc = 0;
   while (argv[argc]) argc++;
@@ -1158,7 +1168,24 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
 
   if (!initialized)
     {
+      symbol_module = scm_call (scm_c_public_ref ("guile", "define-module*"),
+                                scm_list_1 (scm_from_utf8_symbol ("elisp-symbols")),
+                                scm_from_locale_keyword ("pure"),
+                                SCM_BOOL_T,
+                                SCM_UNDEFINED);
+      function_module = scm_call (scm_c_public_ref ("guile", "define-module*"),
+                                  scm_list_1 (scm_from_utf8_symbol ("elisp-functions")),
+                                  scm_from_locale_keyword ("pure"),
+                                  SCM_BOOL_T,
+                                  SCM_UNDEFINED);
+      plist_module = scm_call (scm_c_public_ref ("guile", "define-module*"),
+                                  scm_list_1 (scm_from_utf8_symbol ("elisp-plists")),
+                                  scm_from_locale_keyword ("pure"),
+                                  SCM_BOOL_T,
+                                  SCM_UNDEFINED);
+
       init_alloc_once ();
+      init_guile ();
       init_fns_once ();
       init_obarray ();
       init_eval_once ();
@@ -2071,7 +2098,7 @@ You must run Emacs in batch mode in order to dump it.  */)
 {
   Lisp_Object tem;
   Lisp_Object symbol;
-  ptrdiff_t count = SPECPDL_INDEX ();
+  dynwind_begin ();
 
   check_pure_size ();
 
@@ -2161,7 +2188,8 @@ You must run Emacs in batch mode in order to dump it.  */)
 
   Vpurify_flag = tem;
 
-  return unbind_to (count, Qnil);
+  dynwind_end ();
+  return Qnil;
 }
 
 #endif /* not CANNOT_DUMP */