Overhaul and simplify single_kboard API. Allow calls to `recursive-edit' in process...
[bpt/emacs.git] / src / fns.c
index 3c23aef..48048c5 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -48,6 +48,7 @@ Boston, MA 02110-1301, USA.  */
 #include "frame.h"
 #include "window.h"
 #include "blockinput.h"
+#include "termhooks.h"  /* For display->kboard reference in terminal-local-value. */
 #if defined (HAVE_MENUS) && defined (HAVE_X_WINDOWS)
 #include "xterm.h"
 #endif
@@ -77,10 +78,10 @@ Lisp_Object Qcodeset, Qdays, Qmonths, Qpaper;
 
 extern Lisp_Object Qinput_method_function;
 
-static int internal_equal ();
+static int internal_equal P_ ((Lisp_Object , Lisp_Object, int, int));
 
 extern long get_random ();
-extern void seed_random ();
+extern void seed_random P_ ((long));
 
 #ifndef HAVE_UNISTD_H
 extern long time ();
@@ -2250,7 +2251,7 @@ internal_equal (o1, o2, depth, props)
          if (!internal_equal (OVERLAY_START (o1), OVERLAY_START (o2),
                               depth + 1, props)
              || !internal_equal (OVERLAY_END (o1), OVERLAY_END (o2),
-                                 depth + 1))
+                                 depth + 1, props))
            return 0;
          o1 = XOVERLAY (o1)->plist;
          o2 = XOVERLAY (o2)->plist;
@@ -2554,7 +2555,7 @@ Note that this function doesn't check the parent of CHAR-TABLE.  */)
      Lisp_Object char_table, range;
 {
   int charset_id, c1 = 0, c2 = 0;
-  int size, i;
+  int size;
   Lisp_Object ch, val, current_default;
 
   CHECK_CHAR_TABLE (char_table);
@@ -3267,7 +3268,8 @@ is nil and `use-dialog-box' is non-nil.  */)
     {
 
 #ifdef HAVE_MENUS
-      if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
+      if (FRAME_WINDOW_P (SELECTED_FRAME ())
+          && (NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
          && use_dialog_box
          && have_menus_p ())
        {
@@ -3306,7 +3308,9 @@ is nil and `use-dialog-box' is non-nil.  */)
          Fraise_frame (mini_frame);
        }
 
+      temporarily_switch_to_single_kboard (SELECTED_FRAME ());
       obj = read_filtered_event (1, 0, 0, 0);
+
       cursor_in_echo_area = 0;
       /* If we need to quit, quit with cursor_in_echo_area = 0.  */
       QUIT;
@@ -3398,7 +3402,8 @@ is nil, and `use-dialog-box' is non-nil.  */)
   CHECK_STRING (prompt);
 
 #ifdef HAVE_MENUS
-  if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
+  if (FRAME_WINDOW_P (SELECTED_FRAME ())
+      && (NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
       && use_dialog_box
       && have_menus_p ())
     {
@@ -3514,7 +3519,8 @@ particular subfeatures supported in this version of FEATURE.  */)
   CHECK_SYMBOL (feature);
   CHECK_LIST (subfeatures);
   if (!NILP (Vautoload_queue))
-    Vautoload_queue = Fcons (Fcons (Vfeatures, Qnil), Vautoload_queue);
+    Vautoload_queue = Fcons (Fcons (make_number (0), Vfeatures),
+                            Vautoload_queue);
   tem = Fmemq (feature, Vfeatures);
   if (NILP (tem))
     Vfeatures = Fcons (feature, Vfeatures);
@@ -3559,14 +3565,20 @@ The normal messages at start and end of loading FILENAME are suppressed.  */)
 {
   register Lisp_Object tem;
   struct gcpro gcpro1, gcpro2;
+  int from_file = load_in_progress;
 
   CHECK_SYMBOL (feature);
 
   /* Record the presence of `require' in this file
      even if the feature specified is already loaded.
      But not more than once in any file,
-     and not when we aren't loading a file.  */
-  if (load_in_progress)
+     and not when we aren't loading or reading from a file.  */
+  if (!from_file)
+    for (tem = Vcurrent_load_list; CONSP (tem); tem = XCDR (tem))
+      if (NILP (XCDR (tem)) && STRINGP (XCAR (tem)))
+       from_file = 1;
+
+  if (from_file)
     {
       tem = Fcons (Qrequire, feature);
       if (NILP (Fmember (tem, Vcurrent_load_list)))