diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 26 | ||||
| -rw-r--r-- | src/keyboard.h | 5 | ||||
| -rw-r--r-- | src/keymap.c | 8 |
3 files changed, 20 insertions, 19 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 251516993d6..39e976f3da1 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -415,9 +415,6 @@ Lisp_Object Vecho_keystrokes; | |||
| 415 | /* Form to evaluate (if non-nil) when Emacs is started. */ | 415 | /* Form to evaluate (if non-nil) when Emacs is started. */ |
| 416 | Lisp_Object Vtop_level; | 416 | Lisp_Object Vtop_level; |
| 417 | 417 | ||
| 418 | /* User-supplied table to translate input characters. */ | ||
| 419 | Lisp_Object Vkeyboard_translate_table; | ||
| 420 | |||
| 421 | /* If non-nil, this implements the current input method. */ | 418 | /* If non-nil, this implements the current input method. */ |
| 422 | Lisp_Object Vinput_method_function; | 419 | Lisp_Object Vinput_method_function; |
| 423 | Lisp_Object Qinput_method_function; | 420 | Lisp_Object Qinput_method_function; |
| @@ -3009,15 +3006,15 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 3009 | if (XINT (c) == -1) | 3006 | if (XINT (c) == -1) |
| 3010 | goto exit; | 3007 | goto exit; |
| 3011 | 3008 | ||
| 3012 | if ((STRINGP (Vkeyboard_translate_table) | 3009 | if ((STRINGP (current_kboard->Vkeyboard_translate_table) |
| 3013 | && SCHARS (Vkeyboard_translate_table) > (unsigned) XFASTINT (c)) | 3010 | && SCHARS (current_kboard->Vkeyboard_translate_table) > (unsigned) XFASTINT (c)) |
| 3014 | || (VECTORP (Vkeyboard_translate_table) | 3011 | || (VECTORP (current_kboard->Vkeyboard_translate_table) |
| 3015 | && XVECTOR (Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c)) | 3012 | && XVECTOR (current_kboard->Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c)) |
| 3016 | || (CHAR_TABLE_P (Vkeyboard_translate_table) | 3013 | || (CHAR_TABLE_P (current_kboard->Vkeyboard_translate_table) |
| 3017 | && CHAR_VALID_P (XINT (c), 0))) | 3014 | && CHAR_VALID_P (XINT (c), 0))) |
| 3018 | { | 3015 | { |
| 3019 | Lisp_Object d; | 3016 | Lisp_Object d; |
| 3020 | d = Faref (Vkeyboard_translate_table, c); | 3017 | d = Faref (current_kboard->Vkeyboard_translate_table, c); |
| 3021 | /* nil in keyboard-translate-table means no translation. */ | 3018 | /* nil in keyboard-translate-table means no translation. */ |
| 3022 | if (!NILP (d)) | 3019 | if (!NILP (d)) |
| 3023 | c = d; | 3020 | c = d; |
| @@ -10842,6 +10839,7 @@ init_kboard (kb) | |||
| 10842 | kb->Voverriding_terminal_local_map = Qnil; | 10839 | kb->Voverriding_terminal_local_map = Qnil; |
| 10843 | kb->Vlast_command = Qnil; | 10840 | kb->Vlast_command = Qnil; |
| 10844 | kb->Vreal_last_command = Qnil; | 10841 | kb->Vreal_last_command = Qnil; |
| 10842 | kb->Vkeyboard_translate_table = Qnil; | ||
| 10845 | kb->Vprefix_arg = Qnil; | 10843 | kb->Vprefix_arg = Qnil; |
| 10846 | kb->Vlast_prefix_arg = Qnil; | 10844 | kb->Vlast_prefix_arg = Qnil; |
| 10847 | kb->kbd_queue = Qnil; | 10845 | kb->kbd_queue = Qnil; |
| @@ -11437,8 +11435,8 @@ for that character after that prefix key. */); | |||
| 11437 | Useful to set before you dump a modified Emacs. */); | 11435 | Useful to set before you dump a modified Emacs. */); |
| 11438 | Vtop_level = Qnil; | 11436 | Vtop_level = Qnil; |
| 11439 | 11437 | ||
| 11440 | DEFVAR_LISP ("keyboard-translate-table", &Vkeyboard_translate_table, | 11438 | DEFVAR_KBOARD ("keyboard-translate-table", Vkeyboard_translate_table, |
| 11441 | doc: /* Translate table for keyboard input, or nil. | 11439 | doc: /* Translate table for local keyboard input, or nil. |
| 11442 | If non-nil, the value should be a char-table. Each character read | 11440 | If non-nil, the value should be a char-table. Each character read |
| 11443 | from the keyboard is looked up in this char-table. If the value found | 11441 | from the keyboard is looked up in this char-table. If the value found |
| 11444 | there is non-nil, then it is used instead of the actual input character. | 11442 | there is non-nil, then it is used instead of the actual input character. |
| @@ -11448,8 +11446,10 @@ If it is a string or vector of length N, character codes N and up are left | |||
| 11448 | untranslated. In a vector, an element which is nil means "no translation". | 11446 | untranslated. In a vector, an element which is nil means "no translation". |
| 11449 | 11447 | ||
| 11450 | This is applied to the characters supplied to input methods, not their | 11448 | This is applied to the characters supplied to input methods, not their |
| 11451 | output. See also `translation-table-for-input'. */); | 11449 | output. See also `translation-table-for-input'. |
| 11452 | Vkeyboard_translate_table = Qnil; | 11450 | |
| 11451 | `local-keyboard-translate-table' has a separate binding for each | ||
| 11452 | terminal. See Info node `(elisp)Multiple displays'. */); | ||
| 11453 | 11453 | ||
| 11454 | DEFVAR_BOOL ("cannot-suspend", &cannot_suspend, | 11454 | DEFVAR_BOOL ("cannot-suspend", &cannot_suspend, |
| 11455 | doc: /* Non-nil means to always spawn a subshell instead of suspending. | 11455 | doc: /* Non-nil means to always spawn a subshell instead of suspending. |
diff --git a/src/keyboard.h b/src/keyboard.h index 690cb9cb177..48801dff216 100644 --- a/src/keyboard.h +++ b/src/keyboard.h | |||
| @@ -81,6 +81,9 @@ struct kboard | |||
| 81 | other commands. */ | 81 | other commands. */ |
| 82 | Lisp_Object Vreal_last_command; | 82 | Lisp_Object Vreal_last_command; |
| 83 | 83 | ||
| 84 | /* User-supplied table to translate input characters through. */ | ||
| 85 | Lisp_Object Vkeyboard_translate_table; | ||
| 86 | |||
| 84 | /* The prefix argument for the next command, in raw form. */ | 87 | /* The prefix argument for the next command, in raw form. */ |
| 85 | Lisp_Object Vprefix_arg; | 88 | Lisp_Object Vprefix_arg; |
| 86 | 89 | ||
| @@ -302,8 +305,6 @@ struct input_event; | |||
| 302 | extern Lisp_Object parse_modifiers P_ ((Lisp_Object)); | 305 | extern Lisp_Object parse_modifiers P_ ((Lisp_Object)); |
| 303 | extern Lisp_Object reorder_modifiers P_ ((Lisp_Object)); | 306 | extern Lisp_Object reorder_modifiers P_ ((Lisp_Object)); |
| 304 | extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *)); | 307 | extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *)); |
| 305 | /* User-supplied string to translate input characters through. */ | ||
| 306 | extern Lisp_Object Vkeyboard_translate_table; | ||
| 307 | 308 | ||
| 308 | /* Parent keymap of terminal-local function-key-map instances. */ | 309 | /* Parent keymap of terminal-local function-key-map instances. */ |
| 309 | extern Lisp_Object Vfunction_key_map; | 310 | extern Lisp_Object Vfunction_key_map; |
diff --git a/src/keymap.c b/src/keymap.c index 8fa4d91a9c7..7e5b00bc771 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -2812,11 +2812,11 @@ You type Translation\n\ | |||
| 2812 | outbuf = Fcurrent_buffer (); | 2812 | outbuf = Fcurrent_buffer (); |
| 2813 | 2813 | ||
| 2814 | /* Report on alternates for keys. */ | 2814 | /* Report on alternates for keys. */ |
| 2815 | if (STRINGP (Vkeyboard_translate_table) && !NILP (prefix)) | 2815 | if (STRINGP (current_kboard->Vkeyboard_translate_table) && !NILP (prefix)) |
| 2816 | { | 2816 | { |
| 2817 | int c; | 2817 | int c; |
| 2818 | const unsigned char *translate = SDATA (Vkeyboard_translate_table); | 2818 | const unsigned char *translate = SDATA (current_kboard->Vkeyboard_translate_table); |
| 2819 | int translate_len = SCHARS (Vkeyboard_translate_table); | 2819 | int translate_len = SCHARS (current_kboard->Vkeyboard_translate_table); |
| 2820 | 2820 | ||
| 2821 | for (c = 0; c < translate_len; c++) | 2821 | for (c = 0; c < translate_len; c++) |
| 2822 | if (translate[c] != c) | 2822 | if (translate[c] != c) |
| @@ -2839,7 +2839,7 @@ You type Translation\n\ | |||
| 2839 | insert ("\n", 1); | 2839 | insert ("\n", 1); |
| 2840 | 2840 | ||
| 2841 | /* Insert calls signal_after_change which may GC. */ | 2841 | /* Insert calls signal_after_change which may GC. */ |
| 2842 | translate = SDATA (Vkeyboard_translate_table); | 2842 | translate = SDATA (current_kboard->Vkeyboard_translate_table); |
| 2843 | } | 2843 | } |
| 2844 | 2844 | ||
| 2845 | insert ("\n", 1); | 2845 | insert ("\n", 1); |