diff options
author | Richard M. Stallman <rms@gnu.org> | 1995-10-19 00:20:44 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1995-10-19 00:20:44 +0000 |
commit | 7a4b1927a38ab52cb5a99ebab0b8f2a2c5c766bc (patch) | |
tree | 69cb56759e7119ed99b1d4ed6d88231e4a2a492d /src/keyboard.c | |
parent | 42ee2e87c026e86baf9ead38661a7c8891cf4e13 (diff) | |
download | emacs-7a4b1927a38ab52cb5a99ebab0b8f2a2c5c766bc.tar.gz |
(read_char): Let Vkeyboard_translate_table be char-table.
(syms_of_keyboard): Doc fix.
Diffstat (limited to 'src/keyboard.c')
-rw-r--r-- | src/keyboard.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 10e6a7842ad..cce87895707 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2077,6 +2077,16 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) 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 @@ Useful to set before you dump a modified Emacs."); 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, |