changeset 23065:26b311ef19c6

(read_char): If not reading a key sequence (MAPS is nil), bind input-method-exit-on-first-char and input-method-use-echo-area to t. (read_char): If PREV_EVENT is non-nil, don't run the input method. (read_key_sequence): Do not bind input-method-function.
author Richard M. Stallman <rms@gnu.org>
date Tue, 18 Aug 1998 11:12:25 +0000
parents 32a7b4dc421e
children d40f9a8d7779
files src/keyboard.c
diffstat 1 files changed, 20 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Tue Aug 18 11:06:30 1998 +0000
+++ b/src/keyboard.c	Tue Aug 18 11:12:25 1998 +0000
@@ -1778,7 +1778,10 @@
    MAPS is an array of keymaps;  NMAPS is the length of MAPS.
 
    PREV_EVENT is the previous input event, or nil if we are reading
-   the first event of a key sequence.
+   the first event of a key sequence (or not reading a key sequence).
+   If PREV_EVENT is t, that is a "magic" value that says
+   not to run input methods, but in other respects to act as if
+   not reading a key sequence.
 
    If USED_MOUSE_MENU is non-null, then we set *USED_MOUSE_MENU to 1
    if we used a mouse menu to read the input, or zero otherwise.  If
@@ -2359,12 +2362,16 @@
   /* Pass this to the input method, if appropriate.  */
   if (INTEGERP (c)
       && ! NILP (Vinput_method_function)
+      /* Don't run the input method within a key sequence,
+	 after the first event of the key sequence.  */
+      && NILP (prev_event)
       && (unsigned) XINT (c) >= ' '
       && (unsigned) XINT (c) < 127)
     {
       Lisp_Object keys; 
       int key_count;
       struct gcpro gcpro1;
+      int count = specpdl_ptr - specpdl;
 
       /* Save the echo status.  */
       int saved_immediate_echo = current_kboard->immediate_echo;
@@ -2398,9 +2405,19 @@
       echo_area_glyphs = 0;
       echo_truncate (0);
 
+      /* If we are not reading a key sequence,
+	 never use the echo area.  */
+      if (maps == 0)
+	{
+	  specbind (Qinput_method_exit_on_first_char, Qt);
+	  specbind (Qinput_method_use_echo_area, Qt);
+	}
+
       /* Call the input method.  */
       tem = call1 (Vinput_method_function, c);
-      
+
+      tem = unbind_to (count, tem);
+
       /* Restore the saved echoing state
 	 and this_command_keys state.  */
       this_command_key_count = key_count;
@@ -6773,10 +6790,6 @@
 
   orig_local_map = get_local_map (PT, current_buffer);
 
-  /* Bind input-method-function so that we can set it to nil
-     temporarily after the first input event.  */
-  specbind (Qinput_method_function, Vinput_method_function);
-
   /* 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,
      keybuf[0..mock_input] holds the sequence we should reread.  */
@@ -6948,9 +6961,6 @@
 #endif
 	    key = read_char (NILP (prompt), nmaps, submaps, last_nonmenu_event,
 			     &used_mouse_menu);
-
-	    /* Turn off input methods after a prefix character.  */
-	    Vinput_method_function = Qnil;
 	  }
 
 	  /* read_char returns t when it shows a menu and the user rejects it.
@@ -7692,7 +7702,7 @@
 that this key sequence is being read by something that will\n\
 read commands one after another.  It should be nil if the caller\n\
 will read just one key sequence.")
-  (prompt, continue_echo, dont_downcase_last, can_return_switch_frame)
+  (prompt, continue_echo, dont_downcase_last, can_return_switch_frame, command-loop)
 #endif
 
 DEFUN ("read-key-sequence", Fread_key_sequence, Sread_key_sequence, 1, 5, 0,