aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaroly Lorentey2005-10-28 14:29:24 +0000
committerKaroly Lorentey2005-10-28 14:29:24 +0000
commit2e4782930af512802ac0ee1067d22b5136524dfc (patch)
treed6d1f6be38ffa2b3e7c917246c7a28ce0db58f28
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
-rw-r--r--README.multi-tty8
-rw-r--r--lisp/obsolete/keyswap.el2
-rw-r--r--lisp/simple.el1
-rw-r--r--lisp/subr.el8
-rw-r--r--src/keyboard.c26
-rw-r--r--src/keyboard.h5
-rw-r--r--src/keymap.c8
7 files changed, 31 insertions, 27 deletions
diff --git a/README.multi-tty b/README.multi-tty
index 75d9554f74f..2bba1b9bcb5 100644
--- a/README.multi-tty
+++ b/README.multi-tty
@@ -486,8 +486,6 @@ THINGS TO DO
486 `last-command', but SELECTED_FRAME()->display->kboard to get the 486 `last-command', but SELECTED_FRAME()->display->kboard to get the
487 value of `function-key-map'. 487 value of `function-key-map'.
488 488
489** I think keyboard-translate-table should be made terminal-local.
490
491** The single-keyboard mode of MULTI_KBOARD is extremely confusing 489** The single-keyboard mode of MULTI_KBOARD is extremely confusing
492 sometimes; Emacs does not respond to stimuli from other keyboards. 490 sometimes; Emacs does not respond to stimuli from other keyboards.
493 At least a beep or a message would be important, if the single-mode 491 At least a beep or a message would be important, if the single-mode
@@ -628,6 +626,8 @@ THINGS TO DO
628 that's why raw terminal support is broken again. I really do need 626 that's why raw terminal support is broken again. I really do need
629 to understand input.) 627 to understand input.)
630 628
629** flow-ctrl.el must be updated.
630
631** Fix stuff_char for multi-tty. Doesn't seem to be of high priority. 631** Fix stuff_char for multi-tty. Doesn't seem to be of high priority.
632 632
633DIARY OF CHANGES 633DIARY OF CHANGES
@@ -1257,5 +1257,9 @@ DIARY OF CHANGES
1257 1257
1258 (Fixed in patch-427.) 1258 (Fixed in patch-427.)
1259 1259
1260-- I think keyboard-translate-table should be made terminal-local.
1261
1262 (Done in patch-431.)
1263
1260;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d 1264;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d
1261 1265
diff --git a/lisp/obsolete/keyswap.el b/lisp/obsolete/keyswap.el
index 0ed70d61dee..9651e4d028d 100644
--- a/lisp/obsolete/keyswap.el
+++ b/lisp/obsolete/keyswap.el
@@ -36,7 +36,7 @@
36 ;; Swap ^H and DEL 36 ;; Swap ^H and DEL
37 (aset the-table ?\177 ?\^h) 37 (aset the-table ?\177 ?\^h)
38 (aset the-table ?\^h ?\177) 38 (aset the-table ?\^h ?\177)
39 (setq keyboard-translate-table the-table)) 39 (setq (terminal-local-value 'keyboard-translate-table) the-table))
40 40
41;;; arch-tag: 67cf7009-e23e-421c-9648-078e7277297c 41;;; arch-tag: 67cf7009-e23e-421c-9648-078e7277297c
42;;; keyswap.el ends here 42;;; keyswap.el ends here
diff --git a/lisp/simple.el b/lisp/simple.el
index 16b6ee28953..3a8a737258e 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5370,7 +5370,6 @@ See also `normal-erase-is-backspace'."
5370 (t 5370 (t
5371 (if (terminal-parameter nil 'normal-erase-is-backspace) 5371 (if (terminal-parameter nil 'normal-erase-is-backspace)
5372 (progn 5372 (progn
5373 ;; XXX This should be terminal-local -- lorentey
5374 (keyboard-translate ?\C-h ?\C-?) 5373 (keyboard-translate ?\C-h ?\C-?)
5375 (keyboard-translate ?\C-? ?\C-d)) 5374 (keyboard-translate ?\C-? ?\C-d))
5376 (keyboard-translate ?\C-h ?\C-h) 5375 (keyboard-translate ?\C-h ?\C-h)
diff --git a/lisp/subr.el b/lisp/subr.el
index 48ac3c7e672..01288b44132 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -495,10 +495,10 @@ saving keyboard macros (see `edmacro-mode')."
495 "Translate character FROM to TO at a low level. 495 "Translate character FROM to TO at a low level.
496This function creates a `keyboard-translate-table' if necessary 496This function creates a `keyboard-translate-table' if necessary
497and then modifies one entry in it." 497and then modifies one entry in it."
498 (or (char-table-p keyboard-translate-table) 498 (let (t (terminal-local-value 'keyboard-translate-table))
499 (setq keyboard-translate-table 499 (or (char-table-p t)
500 (make-char-table 'keyboard-translate-table nil))) 500 (setq t (make-char-table 'keyboard-translate-table nil)))
501 (aset keyboard-translate-table from to)) 501 (aset t from to)))
502 502
503 503
504;;;; The global keymap tree. 504;;;; The global keymap tree.
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);