changeset 10626:616345f74278

(cmd_error): Clear prefix arg here. (command_loop_1): Not here. (command_loop_1): Save original perdisplay in case we're already locked to a particular display. Move display-specific cleanup to end of main loop. Use perdisplay to access prefix arg. (Fcommand_execute, Fexecute_extended_command): Use perdisplay.
author Karl Heuer <kwzh@gnu.org>
date Wed, 01 Feb 1995 22:18:21 +0000
parents 4d93473e25b9
children e00a48bb7ad4
files src/keyboard.c
diffstat 1 files changed, 29 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Wed Feb 01 22:06:34 1995 +0000
+++ b/src/keyboard.c	Wed Feb 01 22:18:21 1995 +0000
@@ -705,11 +705,17 @@
   Vstandard_output = Qt;
   Vstandard_input = Qt;
   Vexecuting_macro = Qnil;
+  if (!current_perdisplay)
+    abort ();
+  current_perdisplay->Vprefix_arg = Qnil;
   cmd_error_internal (data, 0);
 
   Vquit_flag = Qnil;
 
   Vinhibit_quit = Qnil;
+#ifdef MULTI_PERDISPLAY
+  current_perdisplay = 0;
+#endif
 
   return make_number (0);
 }
@@ -907,8 +913,8 @@
   int no_direct;
   int prev_modiff;
   struct buffer *prev_buffer;
-
-  Vprefix_arg = Qnil;
+  PERDISPLAY *global_perdisplay = current_perdisplay;
+
   Vdeactivate_mark = Qnil;
   waiting_for_input = 0;
   cancel_echoing ();
@@ -932,11 +938,6 @@
 
   while (1)
     {
-      /* Install chars successfully executed in kbd macro.  */
-
-      if (defining_kbd_macro && NILP (Vprefix_arg))
-	finalize_kbd_macro_chars ();
-
       /* Make sure the current window's buffer is selected.  */
       if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer)
 	set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
@@ -973,7 +974,7 @@
 	}
 
 #ifdef C_ALLOCA
-	  alloca (0);		/* Cause a garbage collection now */
+      alloca (0);		/* Cause a garbage collection now */
 				/* Since we can free the most stuff here.  */
 #endif /* C_ALLOCA */
 
@@ -995,7 +996,7 @@
 	call0 (Qrecompute_lucid_menubar);
 
       /* Read next key sequence; i gets its length.  */
-      i = read_key_sequence (keybuf, (sizeof keybuf / sizeof (keybuf[0])), Qnil, 0);
+      i = read_key_sequence (keybuf, sizeof keybuf / sizeof keybuf[0], Qnil, 0);
 
       ++num_input_keys;
 
@@ -1010,7 +1011,7 @@
 	{
 	  cancel_echoing ();
 	  this_command_key_count = 0;
-	  continue;
+	  goto finalize;
 	}
 
       last_command_char = keybuf[i - 1];
@@ -1057,12 +1058,12 @@
 	  bitch_at_user ();
 	  defining_kbd_macro = 0;
 	  update_mode_lines = 1;
-	  Vprefix_arg = Qnil;
+	  current_perdisplay->Vprefix_arg = Qnil;
 
 	}
       else
 	{
-	  if (NILP (Vprefix_arg) && ! no_direct)
+	  if (NILP (current_perdisplay->Vprefix_arg) && ! no_direct)
 	    {
 	      /* Recognize some common commands in common situations and
 		 do them directly.  */
@@ -1185,7 +1186,7 @@
 	  /* Here for a command that isn't executed directly */
 
 	  nonundocount = 0;
-	  if (NILP (Vprefix_arg))
+	  if (NILP (current_perdisplay->Vprefix_arg))
 	    Fundo_boundary ();
 	  Fcommand_execute (this_command, Qnil);
 
@@ -1209,7 +1210,7 @@
 	 3) we want to leave this_command_key_count non-zero, so that
 	 read_char will realize that it is re-reading a character, and
 	 not echo it a second time.  */
-      if (NILP (Vprefix_arg))
+      if (NILP (current_perdisplay->Vprefix_arg))
 	{
 	  last_command = this_command;
 	  cancel_echoing ();
@@ -1226,6 +1227,16 @@
 	  else if (current_buffer != prev_buffer || MODIFF != prev_modiff)
 	    call1 (Vrun_hooks, intern ("activate-mark-hook"));
 	}
+
+    finalize:
+      /* Install chars successfully executed in kbd macro.  */
+
+      if (defining_kbd_macro && NILP (current_perdisplay->Vprefix_arg))
+	finalize_kbd_macro_chars ();
+
+#ifdef MULTI_PERDISPLAY
+      current_perdisplay = global_perdisplay;
+#endif
     }
 }
 
@@ -5414,8 +5425,9 @@
   struct backtrace backtrace;
   extern int debug_on_next_call;
 
-  prefixarg = Vprefix_arg, Vprefix_arg = Qnil;
-  Vcurrent_prefix_arg = prefixarg;
+  prefixarg = current_perdisplay->Vprefix_arg;
+  current_perdisplay->Vprefix_arg = Qnil;
+  current_perdisplay->Vcurrent_prefix_arg = prefixarg;
   debug_on_next_call = 0;
 
   if (SYMBOLP (cmd))
@@ -5531,7 +5543,7 @@
   UNGCPRO;
 
   function = Fintern (function, Qnil);
-  Vprefix_arg = prefixarg;
+  current_perdisplay->Vprefix_arg = prefixarg;
   this_command = function;
 
   return Fcommand_execute (function, Qt);