aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2005-10-28 14:29:24 +0000
committerKaroly Lorentey2005-10-28 14:29:24 +0000
commit2e4782930af512802ac0ee1067d22b5136524dfc (patch)
treed6d1f6be38ffa2b3e7c917246c7a28ce0db58f28 /src
parent7a81ec10b3821910ca633767b521259a056dbebe (diff)
downloademacs-2e4782930af512802ac0ee1067d22b5136524dfc.tar.gz
emacs-2e4782930af512802ac0ee1067d22b5136524dfc.zip
Change `keyboard-translate-table' to be terminal-local.
* lisp/subr.el (keyboard-translate): Use `terminal-local-value' to access `keyboard-translate-table'. * lisp/obsolete/keyswap.el: Ditto. * src/keyboard.c (Vkeyboard_translate_table): Moved to struct kboard. * src/keyboard.h (Vkeyboard_translate_table): Moved to struct kboard. * src/keyboard.c (read_char): Use current_kboard to access Vkeyboard_translate_table. * src/keymap.c (Fdescribe_buffer_bindings): Ditto. * src/keyboard.c (init_kboard): Initialize Vkeyboard_translate_table. * src/keyboard.c (syms_of_keyboard): Use DEFVAR_KBOARD to define Vkeyboard_translate_table. Update doc strings. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-431
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c26
-rw-r--r--src/keyboard.h5
-rw-r--r--src/keymap.c8
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. */
416Lisp_Object Vtop_level; 416Lisp_Object Vtop_level;
417 417
418/* User-supplied table to translate input characters. */
419Lisp_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. */
422Lisp_Object Vinput_method_function; 419Lisp_Object Vinput_method_function;
423Lisp_Object Qinput_method_function; 420Lisp_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. */);
11437Useful to set before you dump a modified Emacs. */); 11435Useful 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.
11442If non-nil, the value should be a char-table. Each character read 11440If non-nil, the value should be a char-table. Each character read
11443from the keyboard is looked up in this char-table. If the value found 11441from the keyboard is looked up in this char-table. If the value found
11444there is non-nil, then it is used instead of the actual input character. 11442there 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
11448untranslated. In a vector, an element which is nil means "no translation". 11446untranslated. In a vector, an element which is nil means "no translation".
11449 11447
11450This is applied to the characters supplied to input methods, not their 11448This is applied to the characters supplied to input methods, not their
11451output. See also `translation-table-for-input'. */); 11449output. See also `translation-table-for-input'.
11452 Vkeyboard_translate_table = Qnil; 11450
11451`local-keyboard-translate-table' has a separate binding for each
11452terminal. 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;
302extern Lisp_Object parse_modifiers P_ ((Lisp_Object)); 305extern Lisp_Object parse_modifiers P_ ((Lisp_Object));
303extern Lisp_Object reorder_modifiers P_ ((Lisp_Object)); 306extern Lisp_Object reorder_modifiers P_ ((Lisp_Object));
304extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *)); 307extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *));
305/* User-supplied string to translate input characters through. */
306extern 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. */
309extern Lisp_Object Vfunction_key_map; 310extern 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);