changeset 9445:712af9626dc0

(read_key_sequence): The output of function-key-map goes to key-translation-map, but not vice versa. Don't exit if either of them is a possibility.
author Richard M. Stallman <rms@gnu.org>
date Tue, 11 Oct 1994 09:22:44 +0000
parents e21d4ebc3160
children be58ba7c209d
files src/keyboard.c
diffstat 1 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Tue Oct 11 09:03:49 1994 +0000
+++ b/src/keyboard.c	Tue Oct 11 09:22:44 1994 +0000
@@ -4443,6 +4443,7 @@
   /* Nonzero if we seem to have got the beginning of a binding
      in function_key_map.  */
   int function_key_possible = 0;
+  int key_translation_possible = 0;
 
   int junk;
 
@@ -4494,6 +4495,7 @@
 
   starting_buffer = current_buffer;
   function_key_possible = 0;
+  key_translation_possible = 0;
 
   /* Build our list of keymaps.
      If we recognize a function key and replace its escape sequence in
@@ -4555,10 +4557,7 @@
 	     && fkey_start < t
 	     /* mock input is never part of a function key's sequence.  */
 	     && mock_input <= fkey_start)
-	 || (first_binding >= nmaps
-	     && keytran_start < t
-	     /* mock input is never part of a function key's sequence.  */
-	     && mock_input <= keytran_start)
+	 || (keytran_start < t && key_translation_possible)
 	 /* Don't return in the middle of a possible function key sequence,
 	    if the only bindings we found were via case conversion.
 	    Thus, if ESC O a has a function-key-map translation
@@ -5014,6 +5013,10 @@
 		  fkey_start = fkey_end = t;
 		  fkey_map = Vfunction_key_map;
 
+		  /* Do pass the results through key-translation-map.  */
+		  keytran_start = keytran_end = 0;
+		  keytran_map = Vkey_translation_map;
+
 		  goto replay_sequence;
 		}
 	      
@@ -5078,6 +5081,8 @@
 		  error ("Function in key-translation-map returns invalid key sequence");
 	      }
 
+	    key_translation_possible = ! NILP (keytran_next);
+
 	    /* If keybuf[keytran_start..keytran_end] is bound in the
 	       key translation map and it's a suffix of the current
 	       sequence (i.e. keytran_end == t), replace it with
@@ -5108,6 +5113,11 @@
 		keytran_start = keytran_end = t;
 		keytran_map = Vkey_translation_map;
 
+		/* Don't pass the results of key-translation-map
+		   through function-key-map.  */
+		fkey_start = fkey_end = t;
+		fkey_map = Vkey_translation_map;
+
 		goto replay_sequence;
 	      }
 
@@ -5119,6 +5129,7 @@
 	      {
 		keytran_end = ++keytran_start;
 		keytran_map = Vkey_translation_map;
+		key_translation_possible = 0;
 	      }
 	  }
       }
@@ -5128,6 +5139,7 @@
 	 and is an upper case letter
 	 use the corresponding lower-case letter instead.  */
       if (first_binding == nmaps && ! function_key_possible
+	  && ! key_translation_possible
 	  && INTEGERP (key)
 	  && ((((XINT (key) & 0x3ffff)
 		< XSTRING (current_buffer->downcase_table)->size)