Mercurial > emacs
changeset 83391:e99392472e41
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
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Fri, 28 Oct 2005 14:29:24 +0000 |
parents | 513453e09ec7 |
children | 2fdf37d06e0c |
files | README.multi-tty lisp/obsolete/keyswap.el lisp/simple.el lisp/subr.el src/keyboard.c src/keyboard.h src/keymap.c |
diffstat | 7 files changed, 31 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/README.multi-tty Fri Oct 28 11:12:17 2005 +0000 +++ b/README.multi-tty Fri Oct 28 14:29:24 2005 +0000 @@ -486,8 +486,6 @@ `last-command', but SELECTED_FRAME()->display->kboard to get the value of `function-key-map'. -** I think keyboard-translate-table should be made terminal-local. - ** The single-keyboard mode of MULTI_KBOARD is extremely confusing sometimes; Emacs does not respond to stimuli from other keyboards. At least a beep or a message would be important, if the single-mode @@ -628,6 +626,8 @@ that's why raw terminal support is broken again. I really do need to understand input.) +** flow-ctrl.el must be updated. + ** Fix stuff_char for multi-tty. Doesn't seem to be of high priority. DIARY OF CHANGES @@ -1257,5 +1257,9 @@ (Fixed in patch-427.) +-- I think keyboard-translate-table should be made terminal-local. + + (Done in patch-431.) + ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d
--- a/lisp/obsolete/keyswap.el Fri Oct 28 11:12:17 2005 +0000 +++ b/lisp/obsolete/keyswap.el Fri Oct 28 14:29:24 2005 +0000 @@ -36,7 +36,7 @@ ;; Swap ^H and DEL (aset the-table ?\177 ?\^h) (aset the-table ?\^h ?\177) - (setq keyboard-translate-table the-table)) + (setq (terminal-local-value 'keyboard-translate-table) the-table)) ;;; arch-tag: 67cf7009-e23e-421c-9648-078e7277297c ;;; keyswap.el ends here
--- a/lisp/simple.el Fri Oct 28 11:12:17 2005 +0000 +++ b/lisp/simple.el Fri Oct 28 14:29:24 2005 +0000 @@ -5370,7 +5370,6 @@ (t (if (terminal-parameter nil 'normal-erase-is-backspace) (progn - ;; XXX This should be terminal-local -- lorentey (keyboard-translate ?\C-h ?\C-?) (keyboard-translate ?\C-? ?\C-d)) (keyboard-translate ?\C-h ?\C-h)
--- a/lisp/subr.el Fri Oct 28 11:12:17 2005 +0000 +++ b/lisp/subr.el Fri Oct 28 14:29:24 2005 +0000 @@ -495,10 +495,10 @@ "Translate character FROM to TO at a low level. This function creates a `keyboard-translate-table' if necessary and then modifies one entry in it." - (or (char-table-p keyboard-translate-table) - (setq keyboard-translate-table - (make-char-table 'keyboard-translate-table nil))) - (aset keyboard-translate-table from to)) + (let (t (terminal-local-value 'keyboard-translate-table)) + (or (char-table-p t) + (setq t (make-char-table 'keyboard-translate-table nil))) + (aset t from to))) ;;;; The global keymap tree.
--- a/src/keyboard.c Fri Oct 28 11:12:17 2005 +0000 +++ b/src/keyboard.c Fri Oct 28 14:29:24 2005 +0000 @@ -415,9 +415,6 @@ /* Form to evaluate (if non-nil) when Emacs is started. */ Lisp_Object Vtop_level; -/* User-supplied table to translate input characters. */ -Lisp_Object Vkeyboard_translate_table; - /* If non-nil, this implements the current input method. */ Lisp_Object Vinput_method_function; Lisp_Object Qinput_method_function; @@ -3009,15 +3006,15 @@ if (XINT (c) == -1) goto exit; - if ((STRINGP (Vkeyboard_translate_table) - && SCHARS (Vkeyboard_translate_table) > (unsigned) XFASTINT (c)) - || (VECTORP (Vkeyboard_translate_table) - && XVECTOR (Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c)) - || (CHAR_TABLE_P (Vkeyboard_translate_table) + if ((STRINGP (current_kboard->Vkeyboard_translate_table) + && SCHARS (current_kboard->Vkeyboard_translate_table) > (unsigned) XFASTINT (c)) + || (VECTORP (current_kboard->Vkeyboard_translate_table) + && XVECTOR (current_kboard->Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c)) + || (CHAR_TABLE_P (current_kboard->Vkeyboard_translate_table) && CHAR_VALID_P (XINT (c), 0))) { Lisp_Object d; - d = Faref (Vkeyboard_translate_table, c); + d = Faref (current_kboard->Vkeyboard_translate_table, c); /* nil in keyboard-translate-table means no translation. */ if (!NILP (d)) c = d; @@ -10842,6 +10839,7 @@ kb->Voverriding_terminal_local_map = Qnil; kb->Vlast_command = Qnil; kb->Vreal_last_command = Qnil; + kb->Vkeyboard_translate_table = Qnil; kb->Vprefix_arg = Qnil; kb->Vlast_prefix_arg = Qnil; kb->kbd_queue = Qnil; @@ -11437,8 +11435,8 @@ Useful to set before you dump a modified Emacs. */); Vtop_level = Qnil; - DEFVAR_LISP ("keyboard-translate-table", &Vkeyboard_translate_table, - doc: /* Translate table for keyboard input, or nil. + DEFVAR_KBOARD ("keyboard-translate-table", Vkeyboard_translate_table, + doc: /* Translate table for local keyboard input, or nil. If non-nil, the value should be a char-table. Each character read from the keyboard is looked up in this char-table. If the value found there is non-nil, then it is used instead of the actual input character. @@ -11448,8 +11446,10 @@ untranslated. In a vector, an element which is nil means "no translation". This is applied to the characters supplied to input methods, not their -output. See also `translation-table-for-input'. */); - Vkeyboard_translate_table = Qnil; +output. See also `translation-table-for-input'. + +`local-keyboard-translate-table' has a separate binding for each +terminal. See Info node `(elisp)Multiple displays'. */); DEFVAR_BOOL ("cannot-suspend", &cannot_suspend, doc: /* Non-nil means to always spawn a subshell instead of suspending.
--- a/src/keyboard.h Fri Oct 28 11:12:17 2005 +0000 +++ b/src/keyboard.h Fri Oct 28 14:29:24 2005 +0000 @@ -81,6 +81,9 @@ other commands. */ Lisp_Object Vreal_last_command; + /* User-supplied table to translate input characters through. */ + Lisp_Object Vkeyboard_translate_table; + /* The prefix argument for the next command, in raw form. */ Lisp_Object Vprefix_arg; @@ -302,8 +305,6 @@ extern Lisp_Object parse_modifiers P_ ((Lisp_Object)); extern Lisp_Object reorder_modifiers P_ ((Lisp_Object)); extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *)); -/* User-supplied string to translate input characters through. */ -extern Lisp_Object Vkeyboard_translate_table; /* Parent keymap of terminal-local function-key-map instances. */ extern Lisp_Object Vfunction_key_map;
--- a/src/keymap.c Fri Oct 28 11:12:17 2005 +0000 +++ b/src/keymap.c Fri Oct 28 14:29:24 2005 +0000 @@ -2812,11 +2812,11 @@ outbuf = Fcurrent_buffer (); /* Report on alternates for keys. */ - if (STRINGP (Vkeyboard_translate_table) && !NILP (prefix)) + if (STRINGP (current_kboard->Vkeyboard_translate_table) && !NILP (prefix)) { int c; - const unsigned char *translate = SDATA (Vkeyboard_translate_table); - int translate_len = SCHARS (Vkeyboard_translate_table); + const unsigned char *translate = SDATA (current_kboard->Vkeyboard_translate_table); + int translate_len = SCHARS (current_kboard->Vkeyboard_translate_table); for (c = 0; c < translate_len; c++) if (translate[c] != c) @@ -2839,7 +2839,7 @@ insert ("\n", 1); /* Insert calls signal_after_change which may GC. */ - translate = SDATA (Vkeyboard_translate_table); + translate = SDATA (current_kboard->Vkeyboard_translate_table); } insert ("\n", 1);