changeset 13246:47725e106652

(read_char): Let Vkeyboard_translate_table be char-table. (syms_of_keyboard): Doc fix.
author Richard M. Stallman <rms@gnu.org>
date Thu, 19 Oct 1995 00:20:44 +0000
parents 2e0c4159e94b
children 750f4d22537f
files src/keyboard.c
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Thu Oct 19 00:17:11 1995 +0000
+++ b/src/keyboard.c	Thu Oct 19 00:20:44 1995 +0000
@@ -2077,6 +2077,16 @@
       if (STRINGP (Vkeyboard_translate_table)
 	  && XSTRING (Vkeyboard_translate_table)->size > XFASTINT (c))
 	XSETINT (c, XSTRING (Vkeyboard_translate_table)->data[XFASTINT (c)]);
+      else if ((VECTORP (Vkeyboard_translate_table)
+		&& XVECTOR (Vkeyboard_translate_table)->size > XFASTINT (c))
+	       || CHAR_TABLE_P (Vkeyboard_translate_table))
+	{
+	  Lisp_Object d;
+	  d = Faref (Vkeyboard_translate_table, c);
+	  /* nil in keyboard-translate-table means no translation.  */
+	  if (!NILP (d))
+	    c = d;
+	}
     }
 
   /* If this event is a mouse click in the menu bar,
@@ -7370,9 +7380,12 @@
   Vtop_level = Qnil;
 
   DEFVAR_LISP ("keyboard-translate-table", &Vkeyboard_translate_table,
-    "String used as translate table for keyboard input, or nil.\n\
+    "Translate table for keyboard input, or nil.\n\
 Each character is looked up in this string and the contents used instead.\n\
-If string is of length N, character codes N and up are untranslated.");
+The value may be a string, a vector, or a char-table.\n\
+If it is a string or vector of length N,\n\
+character codes N and up are untranslated.\n\
+In a vector or a char-table, an element which is nil means \"no translation\".");
   Vkeyboard_translate_table = Qnil;
 
   DEFVAR_BOOL ("cannot-suspend", &cannot_suspend,