diff src/keyboard.c @ 3452:3393f6e53d25

(read_key_sequence) [!USE_TEXT_PROPERTIES]: Fix typo. (menu_bar_items) [!USE_TEXT_PROPERTIES]: Likewise. (kbd_buffer_get_event): Shorten the first MULTI_FRAME conditional. (lispy_function_keys): Add `remove' key. (read_key_sequence): Take out previous change. If we changed buffers during read_char, go to replay_sequence.
author Richard M. Stallman <rms@gnu.org>
date Thu, 03 Jun 1993 17:46:38 +0000
parents 4a10e4c34b11
children 1fd89e975a78
line wrap: on
line diff
--- a/src/keyboard.c	Thu Jun 03 17:37:18 1993 +0000
+++ b/src/keyboard.c	Thu Jun 03 17:46:38 1993 +0000
@@ -1874,11 +1874,11 @@
 #endif
 	}
 
-#ifdef MULTI_FRAME
       /* If this event is on a different frame, return a switch-frame this
 	 time, and leave the event in the queue for next time.  */
       else
 	{
+#ifdef MULTI_FRAME
 	  Lisp_Object frame = event->frame_or_window;
 	  Lisp_Object focus;
 
@@ -1893,6 +1893,7 @@
 	      && XFRAME (frame) != selected_frame)
 	    obj = make_lispy_switch_frame (frame);
 	  internal_last_event_frame = frame;
+#endif /* MULTI_FRAME */
 
 	  /* If we didn't decide to make a switch-frame event, go ahead
 	     and build a real event from the queue entry.  */
@@ -1909,7 +1910,6 @@
 	      kbd_fetch_ptr = event + 1;
 	    }
 	}
-#endif
     }
   else if (do_mouse_tracking && mouse_moved)
     {
@@ -2024,7 +2024,7 @@
   {
     /* X Keysym value */
 
-    0, 0, 0, 0, 0, 0, 0, 0,	/* 0xff00 */
+    "remove", 0, 0, 0, 0, 0, 0, 0,	/* 0xff00 */
     "backspace",
     "tab",
     "linefeed",
@@ -3097,7 +3097,7 @@
 #ifdef USE_TEXT_PROPERTIES
     maps[nmaps-2] = get_local_map (PT, current_buffer);
 #else
-    maps[nmaps-2] = current_buffer->local_map;
+    maps[nmaps-2] = current_buffer->keymap;
 #endif
     maps[nmaps-1] = global_map;
   }
@@ -3632,10 +3632,14 @@
     echo_start = echo_length ();
   keys_start = this_command_key_count;
 
+#if 0 /* This doesn't quite work, because some of the things
+	 that read_char does cannot safely be bypassed.
+	 It seems too risky to try to make this work right.  */ 
   /* Read the first char of the sequence specially, before setting
      up any keymaps, in case a filter runs and switches buffers on us.  */
   first_event = read_char (!prompt, 0, submaps, last_nonmenu_event,
 			   &junk);
+#endif
 
   /* We jump here when the key sequence has been thoroughly changed, and
      we need to rescan it starting from the beginning.  When we jump here,
@@ -3661,7 +3665,7 @@
 #ifdef USE_TEXT_PROPERTIES
     submaps[nmaps-2] = get_local_map (PT, current_buffer);
 #else
-    submaps[nmaps-2] = current_buffer->local_map;
+    submaps[nmaps-2] = current_buffer->keymap;
 #endif
     submaps[nmaps-1] = global_map;
   }
@@ -3733,16 +3737,12 @@
       /* If not, we should actually read a character.  */
       else
 	{
+	  struct buffer *buf = current_buffer;
+
 	  last_real_key_start = t;
 
-	  if (! NILP (first_event))
-	    {
-	      key = first_event;
-	      first_event = Qnil;
-	    }
-	  else
-	    key = read_char (!prompt, nmaps, submaps, last_nonmenu_event,
-			     &used_mouse_menu);
+	  key = read_char (!prompt, nmaps, submaps, last_nonmenu_event,
+			   &used_mouse_menu);
 
 	  /* read_char returns -1 at the end of a macro.
 	     Emacs 18 handles this by returning immediately with a
@@ -3818,6 +3818,10 @@
 		      keybuf[t+1] = key;
 		      mock_input = t + 2;
 
+		      /* If we switched buffers while reading the first event,
+			 replay in case we switched keymaps too.  */
+		      if (buf != current_buffer && t == 0)
+			goto replay_sequence;
 		      goto replay_key;
 		    }
 		}
@@ -3855,6 +3859,15 @@
 		    }
 		}
 	    }
+
+	  /* If we switched buffers while reading the first event,
+	     replay in case we switched keymaps too.  */
+	  if (buf != current_buffer && t == 0)
+	    {
+	      keybuf[t++] = key;
+	      mock_input = t;
+	      goto replay_sequence;
+	    }
 	}
 
       /* We have finally decided that KEY is something we might want