use dynwind_begin and dynwind_end
[bpt/emacs.git] / src / keyboard.c
index 081a78f..d61960a 100644 (file)
@@ -1404,7 +1404,7 @@ command_loop_1 (void)
        {
          /* Bind inhibit-quit to t so that C-g gets read in
             rather than quitting back to the minibuffer.  */
-         ptrdiff_t count = SPECPDL_INDEX ();
+          dynwind_begin ();
          specbind (Qinhibit_quit, Qt);
 
          sit_for (Vminibuffer_message_timeout, 0, 2);
@@ -1413,7 +1413,7 @@ command_loop_1 (void)
          message1 (0);
          safe_run_hooks (Qecho_area_clear_hook);
 
-         unbind_to (count, Qnil);
+         dynwind_end ();
 
          /* If a C-g came in before, treat it as input now.  */
          if (!NILP (Vquit_flag))
@@ -1527,7 +1527,7 @@ command_loop_1 (void)
          /* Here for a command that isn't executed directly.  */
 
 #ifdef HAVE_WINDOW_SYSTEM
-            ptrdiff_t scount = SPECPDL_INDEX ();
+            dynwind_begin ();
 
             if (display_hourglass_p
                 && NILP (Vexecuting_kbd_macro))
@@ -1553,8 +1553,7 @@ command_loop_1 (void)
             hourglass cursor anyway.
             But don't cancel the hourglass within a macro
             just because a command in the macro finishes.  */
-         if (NILP (Vexecuting_kbd_macro))
-            unbind_to (scount, Qnil);
+            dynwind_end ();
 #endif
           }
       kset_last_prefix_arg (current_kboard, Vcurrent_prefix_arg);
@@ -3095,7 +3094,6 @@ read_char_1 (bool jump, volatile struct read_char_state *state)
       ptrdiff_t key_count;
       bool key_count_reset;
       struct gcpro gcpro1;
-      ptrdiff_t count = SPECPDL_INDEX ();
 
       /* Save the echo status.  */
       bool saved_immediate_echo = current_kboard->immediate_echo;
@@ -3103,6 +3101,8 @@ read_char_1 (bool jump, volatile struct read_char_state *state)
       Lisp_Object saved_echo_string = KVAR (current_kboard, echo_string);
       ptrdiff_t saved_echo_after_prompt = current_kboard->echo_after_prompt;
 
+      dynwind_begin ();
+
 #if 0
       if (before_command_restore_flag)
        {
@@ -3144,7 +3144,7 @@ read_char_1 (bool jump, volatile struct read_char_state *state)
       /* Call the input method.  */
       tem = call1 (Vinput_method_function, c);
 
-      unbind_to (count, tem);
+      dynwind_end ();
 
       /* Restore the saved echoing state
         and this_command_keys state.  */
@@ -3231,7 +3231,7 @@ read_char_1 (bool jump, volatile struct read_char_state *state)
   /* Process the help character specially if enabled.  */
   if (!NILP (Vhelp_form) && help_char_p (c))
     {
-      ptrdiff_t count = SPECPDL_INDEX ();
+      dynwind_begin ();
 
       help_form_saved_window_configs
        = Fcons (Fcurrent_window_configuration (Qnil),
@@ -3249,7 +3249,7 @@ read_char_1 (bool jump, volatile struct read_char_state *state)
        }
       while (BUFFERP (c));
       /* Remove the help from the frame.  */
-      unbind_to (count, Qnil);
+      dynwind_end ();
 
       redisplay ();
       if (EQ (c, make_number (040)))
@@ -8901,8 +8901,6 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
                   bool dont_downcase_last, bool can_return_switch_frame,
                   bool fix_current_buffer, bool prevent_redisplay)
 {
-  ptrdiff_t count = SPECPDL_INDEX ();
-
   /* How many keys there are in the current key sequence.  */
   int t;
 
@@ -8969,6 +8967,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
 
   struct gcpro gcpro1;
 
+  dynwind_begin ();
+
   GCPRO1 (fake_prefixed_keys);
   raw_keybuf_count = 0;
 
@@ -9200,7 +9200,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
             Just return -1.  */
          if (EQ (key, Qt))
            {
-             unbind_to (count, Qnil);
+              dynwind_end ();
              UNGCPRO;
              return -1;
            }
@@ -9759,7 +9759,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
     : Qnil;
 
   unread_switch_frame = delayed_switch_frame;
-  unbind_to (count, Qnil);
+  dynwind_end ();
 
   /* Don't downcase the last character if the caller says don't.
      Don't downcase it if the result is undefined, either.  */