use guile-snarf for subr definition
[bpt/emacs.git] / src / keyboard.c
index 705e919..b09c96d 100644 (file)
@@ -69,6 +69,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include TERM_HEADER
 #endif /* HAVE_WINDOW_SYSTEM */
 
+#include <gc.h> /* for GC_collect_a_little */
+
 /* Variables for blockinput.h:  */
 
 /* Positive if interrupt input is blocked right now.  */
@@ -228,7 +230,7 @@ static Lisp_Object Qbackward_char;
 Lisp_Object Qundefined;
 static Lisp_Object Qtimer_event_handler;
 
-/* read_key_sequence stores here the command definition of the
+/* `read_key_sequence' stores here the command definition of the
    key sequence that it reads.  */
 static Lisp_Object read_key_sequence_cmd;
 static Lisp_Object read_key_sequence_remapped;
@@ -356,7 +358,6 @@ static Lisp_Object Qecho_keystrokes;
 static void recursive_edit_unwind (Lisp_Object buffer);
 static Lisp_Object command_loop (void);
 static Lisp_Object Qcommand_execute;
-struct timespec timer_check (void);
 
 static void echo_now (void);
 static ptrdiff_t echo_length (void);
@@ -377,12 +378,6 @@ bool interrupt_input;
 /* Nonzero while interrupts are temporarily deferred during redisplay.  */
 bool interrupts_deferred;
 
-/* If we support a window system, turn on the code to poll periodically
-   to detect C-g.  It isn't actually used when doing interrupt input.  */
-#ifdef HAVE_WINDOW_SYSTEM
-#define POLL_FOR_INPUT
-#endif
-
 /* The time when Emacs started being idle.  */
 
 static struct timespec timer_idleness_start_time;
@@ -825,22 +820,25 @@ This function is called by the editor initialization to begin editing.  */)
   if (input_blocked_p ())
     return Qnil;
 
-  command_loop_level++;
-  update_mode_lines = 17;
-
-  if (command_loop_level
+  if (command_loop_level >= 0
       && current_buffer != XBUFFER (XWINDOW (selected_window)->contents))
     buffer = Fcurrent_buffer ();
   else
     buffer = Qnil;
 
+  /* Don't do anything interesting between the increment and the
+     record_unwind_protect!  Otherwise, we could get distracted and
+     never decrement the counter again.  */
+  command_loop_level++;
+  update_mode_lines = 17;
+  record_unwind_protect (recursive_edit_unwind, buffer);
+
   /* If we leave recursive_edit_1 below with a `throw' for instance,
      like it is done in the splash screen display, we have to
      make sure that we restore single_kboard as command_loop_1
      would have done if it were left normally.  */
   if (command_loop_level > 0)
     temporarily_switch_to_single_kboard (SELECTED_FRAME ());
-  record_unwind_protect (recursive_edit_unwind, buffer);
 
   recursive_edit_1 ();
   return unbind_to (count, Qnil);
@@ -1219,7 +1217,7 @@ user_error (const char *msg)
   xsignal1 (Quser_error, build_string (msg));
 }
 
-_Noreturn
+/* _Noreturn will be added to prototype by make-docfile.  */
 DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, "",
        doc: /* Exit from the innermost recursive edit or minibuffer.  */)
   (void)
@@ -1230,7 +1228,7 @@ DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0,
   user_error ("No recursive edit is in progress");
 }
 
-_Noreturn
+/* _Noreturn will be added to prototype by make-docfile.  */
 DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0, 0, "",
        doc: /* Abort the command that requested this recursive edit or minibuffer input.  */)
   (void)
@@ -1289,9 +1287,6 @@ usage: (track-mouse BODY...)  */)
    If ignore_mouse_drag_p is non-zero, ignore (implicit) mouse movement
    after resizing the tool-bar window.  */
 
-#if !defined HAVE_WINDOW_SYSTEM || defined USE_GTK || defined HAVE_NS
-static
-#endif
 bool ignore_mouse_drag_p;
 
 static struct frame *
@@ -1320,14 +1315,11 @@ some_mouse_moved (void)
 
 static int read_key_sequence (Lisp_Object *, int, Lisp_Object,
                               bool, bool, bool, bool);
-void safe_run_hooks (Lisp_Object);
 static void adjust_point_for_property (ptrdiff_t, bool);
 
 /* The last boundary auto-added to buffer-undo-list.  */
 Lisp_Object last_undo_boundary;
 
-extern Lisp_Object Qregion_extract_function;
-
 /* FIXME: This is wrong rather than test window-system, we should call
    a new set-selection, which will then dispatch to x-set-selection, or
    tty-set-selection, or w32-set-selection, ...  */
@@ -2088,16 +2080,13 @@ bind_polling_period (int n)
 \f
 /* Apply the control modifier to CHARACTER.  */
 
-#ifndef HAVE_NTGUI
-static
-#endif
 int
 make_ctrl_char (int c)
 {
   /* Save the upper bits here.  */
   int upper = c & ~0177;
 
-  if (! ASCII_BYTE_P (c))
+  if (! ASCII_CHAR_P (c))
     return c |= ctrl_modifier;
 
   c &= 0177;
@@ -2194,7 +2183,7 @@ show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object,
 
 
 \f
-/* Input of single characters from keyboard */
+/* Input of single characters from keyboard */
 
 static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, bool *used_mouse_menu,
                                         struct timespec *end_time);
@@ -2373,6 +2362,13 @@ read_decoded_event_from_main_queue (struct timespec *end_time,
     }
 }
 
+static bool
+echo_keystrokes_p (void)
+{
+  return (FLOATP (Vecho_keystrokes) ? XFLOAT_DATA (Vecho_keystrokes) > 0.0
+         : INTEGERP (Vecho_keystrokes) ? XINT (Vecho_keystrokes) > 0 : false);
+}
+
 /* Read a character from the keyboard; call the redisplay if needed.  */
 /* commandflag 0 means do not autosave, but do redisplay.
    -1 means do not redisplay, but do autosave.
@@ -2430,7 +2426,6 @@ read_char (int commandflag, Lisp_Object map,
 
  retry:
 
-  reread = 0;
   if (CONSP (Vunread_post_input_method_events))
     {
       c = XCAR (Vunread_post_input_method_events);
@@ -2444,9 +2439,12 @@ read_char (int commandflag, Lisp_Object map,
          && NILP (XCDR (c)))
        c = XCAR (c);
 
-      reread = 1;
+      reread = true;
       goto reread_first;
     }
+  else
+    reread = false;
+
 
   if (CONSP (Vunread_command_events))
     {
@@ -2455,17 +2453,13 @@ read_char (int commandflag, Lisp_Object map,
       c = XCAR (Vunread_command_events);
       Vunread_command_events = XCDR (Vunread_command_events);
 
-      reread = 1;
-
       /* Undo what sit-for did when it unread additional keys
         inside universal-argument.  */
 
-      if (CONSP (c)
-         && EQ (XCAR (c), Qt))
-       {
-         reread = 0;
-         c = XCDR (c);
-       }
+      if (CONSP (c) && EQ (XCAR (c), Qt))
+       c = XCDR (c);
+      else
+       reread = true;
 
       /* Undo what read_char_x_menu_prompt did when it unread
         additional keys returned by Fx_popup_menu.  */
@@ -2499,7 +2493,7 @@ read_char (int commandflag, Lisp_Object map,
          && (SYMBOLP (XCAR (c)) || INTEGERP (XCAR (c)))
          && NILP (XCDR (c)))
        c = XCAR (c);
-      reread = 1;
+      reread = true;
       goto reread_for_input_method;
     }
 
@@ -2654,6 +2648,7 @@ read_char (int commandflag, Lisp_Object map,
       /* We must have saved the outer value of getcjmp here,
         so restore it now.  */
       restore_getcjmp (save_jump);
+      pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
       unbind_to (jmpcount, Qnil);
       XSETINT (c, quit_char);
       internal_last_event_frame = selected_frame;
@@ -2708,8 +2703,7 @@ read_char (int commandflag, Lisp_Object map,
       && !current_kboard->immediate_echo
       && this_command_key_count > 0
       && ! noninteractive
-      && (FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
-      && NILP (Fzerop (Vecho_keystrokes))
+      && echo_keystrokes_p ()
       && (/* No message.  */
          NILP (echo_area_buffer[0])
          /* Or empty message.  */
@@ -2818,7 +2812,7 @@ read_char (int commandflag, Lisp_Object map,
 
       /* If there is still no input available, ask for GC.  */
       if (!detect_input_pending_run_timers (0))
-       maybe_gc ();
+       GC_collect_a_little ();
     }
 
   /* Notify the caller if an autosave hook, or a timer, sentinel or
@@ -2840,6 +2834,11 @@ read_char (int commandflag, Lisp_Object map,
     {
       c = XCAR (Vunread_command_events);
       Vunread_command_events = XCDR (Vunread_command_events);
+
+      if (CONSP (c) && EQ (XCAR (c), Qt))
+       c = XCDR (c);
+      else
+       reread = true;
     }
 
   /* Read something from current KBOARD's side queue, if possible.  */
@@ -2893,8 +2892,8 @@ read_char (int commandflag, Lisp_Object map,
     {
       c = read_decoded_event_from_main_queue (end_time, local_getcjmp,
                                               prev_event, used_mouse_menu);
-      if (NILP(c) && end_time &&
-          timespec_cmp (*end_time, current_timespec ()) <= 0)
+      if (NILP (c) && end_time
+         && timespec_cmp (*end_time, current_timespec ()) <= 0)
         {
           goto exit;
         }
@@ -3170,8 +3169,7 @@ read_char (int commandflag, Lisp_Object map,
     {
 
       /* Don't echo mouse motion events.  */
-      if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
-         && NILP (Fzerop (Vecho_keystrokes))
+      if (echo_keystrokes_p ()
          && ! (EVENT_HAS_PARAMETERS (c)
                && EQ (EVENT_HEAD_KIND (EVENT_HEAD (c)), Qmouse_movement)))
        {
@@ -3247,8 +3245,7 @@ record_menu_key (Lisp_Object c)
 #endif
 
   /* Don't echo mouse motion events.  */
-  if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
-      && NILP (Fzerop (Vecho_keystrokes)))
+  if (echo_keystrokes_p ())
     {
       echo_char (c);
 
@@ -3655,7 +3652,8 @@ kbd_buffer_store_event_hold (register struct input_event *event,
       *kbd_store_ptr = *event;
       ++kbd_store_ptr;
 #ifdef subprocesses
-      if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE/2 && ! kbd_on_hold_p ())
+      if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE / 2
+         && ! kbd_on_hold_p ())
         {
           /* Don't read keyboard input until we have processed kbd_buffer.
              This happens when pasting text longer than KBD_BUFFER_SIZE/2.  */
@@ -5223,7 +5221,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
       /* It's a click in window WINDOW at frame coordinates (X,Y)  */
       struct window *w = XWINDOW (window);
       Lisp_Object string_info = Qnil;
-      ptrdiff_t textpos = -1;
+      ptrdiff_t textpos = 0;
       int col = -1, row = -1;
       int dx  = -1, dy  = -1;
       int width = -1, height = -1;
@@ -5258,9 +5256,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
                                     &object, &dx, &dy, &width, &height);
          if (STRINGP (string))
            string_info = Fcons (string, make_number (charpos));
-         textpos = (w == XWINDOW (selected_window)
-                    && current_buffer == XBUFFER (w->contents))
-           ? PT : marker_position (w->pointm);
+         textpos = -1;
 
          xret = wx;
          yret = wy;
@@ -5328,7 +5324,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
       /* For clicks in the text area, fringes, or margins, call
         buffer_posn_from_coords to extract TEXTPOS, the buffer
         position nearest to the click.  */
-      if (textpos < 0)
+      if (!textpos)
        {
          Lisp_Object string2, object2 = Qnil;
          struct display_pos p;
@@ -5379,15 +5375,15 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
        }
 #endif
 
-      /* Object info */
+      /* Object info */
       extra_info
        = list3 (object,
                 Fcons (make_number (dx), make_number (dy)),
                 Fcons (make_number (width), make_number (height)));
 
-      /* String info */
+      /* String info */
       extra_info = Fcons (string_info,
-                         Fcons (make_number (textpos),
+                         Fcons (textpos < 0 ? Qnil : make_number (textpos),
                                 Fcons (Fcons (make_number (col),
                                               make_number (row)),
                                        extra_info)));
@@ -6870,6 +6866,20 @@ gobble_input (void)
              }
             }
 
+         /* If there was no error, make sure the pointer
+            is visible for all frames on this terminal.  */
+         if (nr >= 0)
+           {
+             Lisp_Object tail, frame;
+
+             FOR_EACH_FRAME (tail, frame)
+               {
+                 struct frame *f = XFRAME (frame);
+                 if (FRAME_TERMINAL (f) == t)
+                   frame_make_pointer_visible (f);
+               }
+           }
+
           if (hold_quit.kind != NO_EVENT)
             kbd_buffer_store_event (&hold_quit);
         }
@@ -6880,8 +6890,6 @@ gobble_input (void)
   if (err && !nread)
     nread = -1;
 
-  frame_make_pointer_visible ();
-
   return nread;
 }
 
@@ -7472,8 +7480,8 @@ menu_bar_items (Lisp_Object old)
   {
     int i = menu_bar_items_index;
     if (i + 4 > ASIZE (menu_bar_items_vector))
-      menu_bar_items_vector =
-       larger_vector (menu_bar_items_vector, 4, -1);
+      menu_bar_items_vector
+       larger_vector (menu_bar_items_vector, 4, -1);
     /* Add this item.  */
     ASET (menu_bar_items_vector, i, Qnil); i++;
     ASET (menu_bar_items_vector, i, Qnil); i++;
@@ -8243,7 +8251,7 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
       const char *capt = STRINGP (tcapt) ? SSDATA (tcapt) : "";
       ptrdiff_t max_lbl =
        2 * max (0, min (tool_bar_max_label_size, STRING_BYTES_BOUND / 2));
-      char *buf = xmalloc (max_lbl + 1);
+      char *buf = xmalloc_atomic (max_lbl + 1);
       Lisp_Object new_lbl;
       ptrdiff_t caption_len = strlen (capt);
 
@@ -8928,8 +8936,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
          echo_now ();
        }
       else if (cursor_in_echo_area
-              && (FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
-              && NILP (Fzerop (Vecho_keystrokes)))
+              && echo_keystrokes_p ())
        /* This doesn't put in a dash if the echo buffer is empty, so
           you don't always see a dash hanging out in the minibuffer.  */
        echo_dash ();
@@ -9061,8 +9068,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
        {
          key = keybuf[t];
          add_command_key (key);
-         if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
-             && NILP (Fzerop (Vecho_keystrokes))
+         if (echo_keystrokes_p ()
              && current_kboard->immediate_echo)
            {
              echo_add_key (key);
@@ -9378,16 +9384,6 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
          first_unbound = min (t, first_unbound);
 
          head = EVENT_HEAD (key);
-         if (help_char_p (head) && t > 0)
-           {
-             read_key_sequence_cmd = Vprefix_help_command;
-             keybuf[t++] = key;
-             last_nonmenu_event = key;
-             /* The Microsoft C compiler can't handle the goto that
-                would go here.  */
-             dummyflag = 1;
-             break;
-           }
 
          if (SYMBOLP (head))
            {
@@ -9645,6 +9641,17 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
 
          goto replay_sequence;
        }
+
+      if (NILP (current_binding)
+         && help_char_p (EVENT_HEAD (key)) && t > 1)
+           {
+             read_key_sequence_cmd = Vprefix_help_command;
+             /* The Microsoft C compiler can't handle the goto that
+                would go here.  */
+             dummyflag = 1;
+             break;
+           }
+
       /* If KEY is not defined in any of the keymaps,
         and cannot be part of a function key or translation,
         and is a shifted function key,
@@ -9726,8 +9733,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
      Better ideas?  */
   for (; t < mock_input; t++)
     {
-      if ((FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
-         && NILP (Fzerop (Vecho_keystrokes)))
+      if (echo_keystrokes_p ())
        echo_char (keybuf[t]);
       add_command_key (keybuf[t]);
     }
@@ -10307,9 +10313,6 @@ static void
 handle_interrupt (bool in_signal_handler)
 {
   char c;
-  sigset_t blocked;
-  sigemptyset (&blocked);
-  sigaddset (&blocked, SIGINT);
 
   cancel_echoing ();
 
@@ -10321,6 +10324,9 @@ handle_interrupt (bool in_signal_handler)
          /* If SIGINT isn't blocked, don't let us be interrupted by
             a SIGINT.  It might be harmful due to non-reentrancy
             in I/O functions.  */
+         sigset_t blocked;
+         sigemptyset (&blocked);
+         sigaddset (&blocked, SIGINT);
          pthread_sigmask (SIG_BLOCK, &blocked, 0);
        }
 
@@ -10348,34 +10354,18 @@ handle_interrupt (bool in_signal_handler)
         is used.  Note that [Enter] is not echoed by dos.  */
       cursor_to (SELECTED_FRAME (), 0, 0);
 #endif
-      /* It doesn't work to autosave while GC is in progress;
-        the code used for auto-saving doesn't cope with the mark bit.  */
-      if (!gc_in_progress)
-       {
-         printf ("Auto-save? (y or n) ");
-         fflush (stdout);
-         if (((c = getchar ()) & ~040) == 'Y')
-           {
-             Fdo_auto_save (Qt, Qnil);
+      printf ("Auto-save? (y or n) ");
+      fflush (stdout);
+      if (((c = getchar ()) & ~040) == 'Y')
+        {
+          Fdo_auto_save (Qt, Qnil);
 #ifdef MSDOS
-             printf ("\r\nAuto-save done");
+          printf ("\r\nAuto-save done");
 #else /* not MSDOS */
-             printf ("Auto-save done\n");
-#endif /* not MSDOS */
-           }
-         while (c != '\n') c = getchar ();
-       }
-      else
-       {
-         /* During GC, it must be safe to reenable quitting again.  */
-         Vinhibit_quit = Qnil;
-#ifdef MSDOS
-         printf ("\r\n");
+          printf ("Auto-save done\n");
 #endif /* not MSDOS */
-         printf ("Garbage collection in progress; cannot auto-save now\r\n");
-         printf ("but will instead do a real quit after garbage collection ends\r\n");
-         fflush (stdout);
-       }
+        }
+      while (c != '\n') c = getchar ();
 
 #ifdef MSDOS
       printf ("\r\nAbort?  (y or n) ");
@@ -10405,7 +10395,7 @@ handle_interrupt (bool in_signal_handler)
          struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
 
          immediate_quit = 0;
-         pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
+         pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
          saved = gl_state;
          GCPRO4 (saved.object, saved.global_code,
                  saved.current_syntax_table, saved.old_prop);
@@ -10426,7 +10416,7 @@ handle_interrupt (bool in_signal_handler)
         }
     }
 
-  pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
+  pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
 
 /* TODO: The longjmp in this call throws the NS event loop integration off,
          and it seems to do fine without this.  Probably some attention
@@ -10945,6 +10935,8 @@ static const struct event_head head_table[] = {
 void
 syms_of_keyboard (void)
 {
+#include "keyboard.x"
+
   pending_funcalls = Qnil;
   staticpro (&pending_funcalls);
 
@@ -11124,38 +11116,6 @@ syms_of_keyboard (void)
   help_form_saved_window_configs = Qnil;
   staticpro (&help_form_saved_window_configs);
 
-  defsubr (&Scurrent_idle_time);
-  defsubr (&Sevent_symbol_parse_modifiers);
-  defsubr (&Sevent_convert_list);
-  defsubr (&Sread_key_sequence);
-  defsubr (&Sread_key_sequence_vector);
-  defsubr (&Srecursive_edit);
-  defsubr (&Strack_mouse);
-  defsubr (&Sinput_pending_p);
-  defsubr (&Srecent_keys);
-  defsubr (&Sthis_command_keys);
-  defsubr (&Sthis_command_keys_vector);
-  defsubr (&Sthis_single_command_keys);
-  defsubr (&Sthis_single_command_raw_keys);
-  defsubr (&Sreset_this_command_lengths);
-  defsubr (&Sclear_this_command_keys);
-  defsubr (&Ssuspend_emacs);
-  defsubr (&Sabort_recursive_edit);
-  defsubr (&Sexit_recursive_edit);
-  defsubr (&Srecursion_depth);
-  defsubr (&Scommand_error_default_function);
-  defsubr (&Stop_level);
-  defsubr (&Sdiscard_input);
-  defsubr (&Sopen_dribble_file);
-  defsubr (&Sset_input_interrupt_mode);
-  defsubr (&Sset_output_flow_control);
-  defsubr (&Sset_input_meta_mode);
-  defsubr (&Sset_quit_char);
-  defsubr (&Sset_input_mode);
-  defsubr (&Scurrent_input_mode);
-  defsubr (&Sposn_at_point);
-  defsubr (&Sposn_at_x_y);
-
   DEFVAR_LISP ("last-command-event", last_command_event,
                     doc: /* Last input event that was part of a command.  */);
 
@@ -11755,52 +11715,3 @@ keys_of_keyboard (void)
   initial_define_lispy_key (Vspecial_event_map, "focus-out",
                            "handle-focus-out");
 }
-
-/* Mark the pointers in the kboard objects.
-   Called by Fgarbage_collect.  */
-void
-mark_kboards (void)
-{
-  KBOARD *kb;
-  Lisp_Object *p;
-  for (kb = all_kboards; kb; kb = kb->next_kboard)
-    {
-      if (kb->kbd_macro_buffer)
-       for (p = kb->kbd_macro_buffer; p < kb->kbd_macro_ptr; p++)
-         mark_object (*p);
-      mark_object (KVAR (kb, Voverriding_terminal_local_map));
-      mark_object (KVAR (kb, Vlast_command));
-      mark_object (KVAR (kb, Vreal_last_command));
-      mark_object (KVAR (kb, Vkeyboard_translate_table));
-      mark_object (KVAR (kb, Vlast_repeatable_command));
-      mark_object (KVAR (kb, Vprefix_arg));
-      mark_object (KVAR (kb, Vlast_prefix_arg));
-      mark_object (KVAR (kb, kbd_queue));
-      mark_object (KVAR (kb, defining_kbd_macro));
-      mark_object (KVAR (kb, Vlast_kbd_macro));
-      mark_object (KVAR (kb, Vsystem_key_alist));
-      mark_object (KVAR (kb, system_key_syms));
-      mark_object (KVAR (kb, Vwindow_system));
-      mark_object (KVAR (kb, Vinput_decode_map));
-      mark_object (KVAR (kb, Vlocal_function_key_map));
-      mark_object (KVAR (kb, Vdefault_minibuffer_frame));
-      mark_object (KVAR (kb, echo_string));
-    }
-  {
-    struct input_event *event;
-    for (event = kbd_fetch_ptr; event != kbd_store_ptr; event++)
-      {
-       if (event == kbd_buffer + KBD_BUFFER_SIZE)
-         event = kbd_buffer;
-       /* These two special event types has no Lisp_Objects to mark.  */
-       if (event->kind != SELECTION_REQUEST_EVENT
-           && event->kind != SELECTION_CLEAR_EVENT)
-         {
-           mark_object (event->x);
-           mark_object (event->y);
-           mark_object (event->frame_or_window);
-           mark_object (event->arg);
-         }
-      }
-  }
-}