]> git.eshelyaron.com Git - emacs.git/commitdiff
* src/keyboard.c (Frecursive_edit): Ensure inc&dec of command_loop_level
authorSamuel Bronson <naesten@gmail.com>
Tue, 6 May 2014 16:16:57 +0000 (12:16 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 6 May 2014 16:16:57 +0000 (12:16 -0400)
are matched.

Fixes: debbugs:17413
lib-src/ChangeLog
src/ChangeLog
src/keyboard.c

index 2176549a351e21322d0d5fa6eabf7cf8ed6bd79b..c0df532fbb652c1dc4f25acb8937bd39a9c39e8d 100644 (file)
        Use _Noreturn rather than NO_RETURN.
        No need for separate decl merely because of _Noreturn.
 
-2012-06-24  Samuel Bronson  <naesten@gmail.com>  (tiny change)
+2012-06-24  Samuel Bronson  <naesten@gmail.com>
 
        * emacsclient.c (set_local_socket): Fix compiler warning (Bug#7838).
 
index 720ab11135fc5635c40ed17a58750460f543dd81..c1d45f1df40250654513acf7f818c16b1b1c6c2d 100644 (file)
@@ -1,3 +1,8 @@
+2014-05-06  Samuel Bronson  <naesten@gmail.com>
+
+       * keyboard.c (Frecursive_edit): Ensure inc&dec of command_loop_level
+       are matched (bug#17413).
+
 2014-05-06  Jarek Czekalski  <jarekczek@poczta.onet.pl>
 
        Stop tooltips pulling Emacs window to front (Bug#17408).
index 90479375072261f3f61ca5aa4c07e3ef8c430008..8bc0c108739ad8b30561e2438302798a72aae722 100644 (file)
@@ -825,22 +825,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);