diff options
| author | Karoly Lorentey | 2005-06-25 16:34:30 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-06-25 16:34:30 +0000 |
| commit | f01b6d17cc07655d6ce62a4ac5097947529b81a2 (patch) | |
| tree | 564750204b28a321fcfaf196c5316f482f5ad5d9 /src | |
| parent | 0d0358be7e741898e363d02dbff01b35c662413c (diff) | |
| download | emacs-f01b6d17cc07655d6ce62a4ac5097947529b81a2.tar.gz emacs-f01b6d17cc07655d6ce62a4ac5097947529b81a2.zip | |
Make function-key-map a terminal-local variable (move it inside the kboard struct).
* src/keyboard.h (kboard): Move Vfunction_key_map inside the kboard struct.
* src/keyboard.c (Vfunction_key_map): Remove declaration.
(read_key_sequence, init_kboard): Update references to Vfunction_key_map.
(syms_of_keyboard): Declare function-key-map as a terminal-local variable.
(mark_kboards): Mark Vfunction_key_map.
* src/keymap.c (Vfunction_key_map): Remove.
(Fdescribe_buffer_bindings): Update references to Vfunction_key_map.
(syms_of_keymap): Remove DEFVAR for Vfunction_key_map.
* src/term.c (term_get_fkeys_1): Update references to Vfunction_key_map.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-355
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 30 | ||||
| -rw-r--r-- | src/keyboard.h | 9 | ||||
| -rw-r--r-- | src/keymap.c | 31 | ||||
| -rw-r--r-- | src/term.c | 14 |
4 files changed, 40 insertions, 44 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 7f81dde35c7..13bf7131e0e 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -417,9 +417,6 @@ Lisp_Object Vtop_level; | |||
| 417 | /* User-supplied table to translate input characters. */ | 417 | /* User-supplied table to translate input characters. */ |
| 418 | Lisp_Object Vkeyboard_translate_table; | 418 | Lisp_Object Vkeyboard_translate_table; |
| 419 | 419 | ||
| 420 | /* Keymap mapping ASCII function key sequences onto their preferred forms. */ | ||
| 421 | extern Lisp_Object Vfunction_key_map; | ||
| 422 | |||
| 423 | /* Another keymap that maps key sequences into key sequences. | 420 | /* Another keymap that maps key sequences into key sequences. |
| 424 | This one takes precedence over ordinary definitions. */ | 421 | This one takes precedence over ordinary definitions. */ |
| 425 | extern Lisp_Object Vkey_translation_map; | 422 | extern Lisp_Object Vkey_translation_map; |
| @@ -8654,7 +8651,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, | |||
| 8654 | last_nonmenu_event = Qnil; | 8651 | last_nonmenu_event = Qnil; |
| 8655 | 8652 | ||
| 8656 | delayed_switch_frame = Qnil; | 8653 | delayed_switch_frame = Qnil; |
| 8657 | fkey.map = fkey.parent = Vfunction_key_map; | 8654 | fkey.map = fkey.parent = current_kboard->Vfunction_key_map; |
| 8658 | keytran.map = keytran.parent = Vkey_translation_map; | 8655 | keytran.map = keytran.parent = Vkey_translation_map; |
| 8659 | /* If there is no translation-map, turn off scanning. */ | 8656 | /* If there is no translation-map, turn off scanning. */ |
| 8660 | fkey.start = fkey.end = KEYMAPP (fkey.map) ? 0 : bufsize + 1; | 8657 | fkey.start = fkey.end = KEYMAPP (fkey.map) ? 0 : bufsize + 1; |
| @@ -10766,6 +10763,7 @@ init_kboard (kb) | |||
| 10766 | kb->reference_count = 0; | 10763 | kb->reference_count = 0; |
| 10767 | kb->Vsystem_key_alist = Qnil; | 10764 | kb->Vsystem_key_alist = Qnil; |
| 10768 | kb->system_key_syms = Qnil; | 10765 | kb->system_key_syms = Qnil; |
| 10766 | kb->Vfunction_key_map = Fmake_sparse_keymap (Qnil); | ||
| 10769 | kb->Vdefault_minibuffer_frame = Qnil; | 10767 | kb->Vdefault_minibuffer_frame = Qnil; |
| 10770 | } | 10768 | } |
| 10771 | 10769 | ||
| @@ -11465,6 +11463,29 @@ Each element should have the form (N . SYMBOL) where N is the | |||
| 11465 | numeric keysym code (sans the \"system-specific\" bit 1<<28) | 11463 | numeric keysym code (sans the \"system-specific\" bit 1<<28) |
| 11466 | and SYMBOL is its name. */); | 11464 | and SYMBOL is its name. */); |
| 11467 | 11465 | ||
| 11466 | DEFVAR_KBOARD ("function-key-map", Vfunction_key_map, | ||
| 11467 | doc: /* Keymap mapping ASCII function key sequences onto their preferred forms. | ||
| 11468 | This allows Emacs to recognize function keys sent from ASCII | ||
| 11469 | terminals at any point in a key sequence. | ||
| 11470 | |||
| 11471 | The `read-key-sequence' function replaces any subsequence bound by | ||
| 11472 | `function-key-map' with its binding. More precisely, when the active | ||
| 11473 | keymaps have no binding for the current key sequence but | ||
| 11474 | `function-key-map' binds a suffix of the sequence to a vector or string, | ||
| 11475 | `read-key-sequence' replaces the matching suffix with its binding, and | ||
| 11476 | continues with the new sequence. | ||
| 11477 | |||
| 11478 | The events that come from bindings in `function-key-map' are not | ||
| 11479 | themselves looked up in `function-key-map'. | ||
| 11480 | |||
| 11481 | For example, suppose `function-key-map' binds `ESC O P' to [f1]. | ||
| 11482 | Typing `ESC O P' to `read-key-sequence' would return [f1]. Typing | ||
| 11483 | `C-x ESC O P' would return [?\\C-x f1]. If [f1] were a prefix | ||
| 11484 | key, typing `ESC O P x' would return [f1 x]. | ||
| 11485 | |||
| 11486 | `function-key-map' has a separate binding for each display device. | ||
| 11487 | See Info node `(elisp)Multiple displays'. */); | ||
| 11488 | |||
| 11468 | DEFVAR_LISP ("deferred-action-list", &Vdeferred_action_list, | 11489 | DEFVAR_LISP ("deferred-action-list", &Vdeferred_action_list, |
| 11469 | doc: /* List of deferred actions to be performed at a later time. | 11490 | doc: /* List of deferred actions to be performed at a later time. |
| 11470 | The precise format isn't relevant here; we just check whether it is nil. */); | 11491 | The precise format isn't relevant here; we just check whether it is nil. */); |
| @@ -11628,6 +11649,7 @@ mark_kboards () | |||
| 11628 | mark_object (kb->Vlast_kbd_macro); | 11649 | mark_object (kb->Vlast_kbd_macro); |
| 11629 | mark_object (kb->Vsystem_key_alist); | 11650 | mark_object (kb->Vsystem_key_alist); |
| 11630 | mark_object (kb->system_key_syms); | 11651 | mark_object (kb->system_key_syms); |
| 11652 | mark_object (kb->Vfunction_key_map); | ||
| 11631 | mark_object (kb->Vdefault_minibuffer_frame); | 11653 | mark_object (kb->Vdefault_minibuffer_frame); |
| 11632 | mark_object (kb->echo_string); | 11654 | mark_object (kb->echo_string); |
| 11633 | } | 11655 | } |
diff --git a/src/keyboard.h b/src/keyboard.h index 8ff1543d92e..d0d93603379 100644 --- a/src/keyboard.h +++ b/src/keyboard.h | |||
| @@ -120,6 +120,11 @@ struct kboard | |||
| 120 | /* Cache for modify_event_symbol. */ | 120 | /* Cache for modify_event_symbol. */ |
| 121 | Lisp_Object system_key_syms; | 121 | Lisp_Object system_key_syms; |
| 122 | 122 | ||
| 123 | /* Keymap mapping ASCII function key sequences onto their | ||
| 124 | preferred forms. Initialized by the terminal-specific lisp | ||
| 125 | files. See the DEFVAR for more documentation. */ | ||
| 126 | Lisp_Object Vfunction_key_map; | ||
| 127 | |||
| 123 | /* Minibufferless frames on this display use this frame's minibuffer. */ | 128 | /* Minibufferless frames on this display use this frame's minibuffer. */ |
| 124 | Lisp_Object Vdefault_minibuffer_frame; | 129 | Lisp_Object Vdefault_minibuffer_frame; |
| 125 | 130 | ||
| @@ -187,10 +192,6 @@ extern EMACS_INT num_nonmacro_input_events; | |||
| 187 | /* Nonzero means polling for input is temporarily suppressed. */ | 192 | /* Nonzero means polling for input is temporarily suppressed. */ |
| 188 | extern int poll_suppress_count; | 193 | extern int poll_suppress_count; |
| 189 | 194 | ||
| 190 | /* Keymap mapping ASCII function key sequences onto their preferred forms. | ||
| 191 | Initialized by the terminal-specific lisp files. */ | ||
| 192 | extern Lisp_Object Vfunction_key_map; | ||
| 193 | |||
| 194 | /* Vector holding the key sequence that invoked the current command. | 195 | /* Vector holding the key sequence that invoked the current command. |
| 195 | It is reused for each command, and it may be longer than the current | 196 | It is reused for each command, and it may be longer than the current |
| 196 | sequence; this_command_key_count indicates how many elements | 197 | sequence; this_command_key_count indicates how many elements |
diff --git a/src/keymap.c b/src/keymap.c index 3706ad52c9e..1734ac1baa9 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -79,11 +79,6 @@ Lisp_Object Vminor_mode_overriding_map_alist; | |||
| 79 | /* List of emulation mode keymap alists. */ | 79 | /* List of emulation mode keymap alists. */ |
| 80 | Lisp_Object Vemulation_mode_map_alists; | 80 | Lisp_Object Vemulation_mode_map_alists; |
| 81 | 81 | ||
| 82 | /* Keymap mapping ASCII function key sequences onto their preferred forms. | ||
| 83 | Initialized by the terminal-specific lisp files. See DEFVAR for more | ||
| 84 | documentation. */ | ||
| 85 | Lisp_Object Vfunction_key_map; | ||
| 86 | |||
| 87 | /* Keymap mapping ASCII function key sequences onto their preferred forms. */ | 82 | /* Keymap mapping ASCII function key sequences onto their preferred forms. */ |
| 88 | Lisp_Object Vkey_translation_map; | 83 | Lisp_Object Vkey_translation_map; |
| 89 | 84 | ||
| @@ -2939,8 +2934,8 @@ You type Translation\n\ | |||
| 2939 | "\f\nGlobal Bindings", nomenu, 0, 1, 0); | 2934 | "\f\nGlobal Bindings", nomenu, 0, 1, 0); |
| 2940 | 2935 | ||
| 2941 | /* Print the function-key-map translations under this prefix. */ | 2936 | /* Print the function-key-map translations under this prefix. */ |
| 2942 | if (!NILP (Vfunction_key_map)) | 2937 | if (!NILP (current_kboard->Vfunction_key_map)) |
| 2943 | describe_map_tree (Vfunction_key_map, 0, Qnil, prefix, | 2938 | describe_map_tree (current_kboard->Vfunction_key_map, 0, Qnil, prefix, |
| 2944 | "\f\nFunction key map translations", nomenu, 1, 0, 0); | 2939 | "\f\nFunction key map translations", nomenu, 1, 0, 0); |
| 2945 | 2940 | ||
| 2946 | UNGCPRO; | 2941 | UNGCPRO; |
| @@ -3802,28 +3797,6 @@ the same way. The "active" keymaps in each alist are used before | |||
| 3802 | `minor-mode-map-alist' and `minor-mode-overriding-map-alist'. */); | 3797 | `minor-mode-map-alist' and `minor-mode-overriding-map-alist'. */); |
| 3803 | Vemulation_mode_map_alists = Qnil; | 3798 | Vemulation_mode_map_alists = Qnil; |
| 3804 | 3799 | ||
| 3805 | |||
| 3806 | DEFVAR_LISP ("function-key-map", &Vfunction_key_map, | ||
| 3807 | doc: /* Keymap mapping ASCII function key sequences onto their preferred forms. | ||
| 3808 | This allows Emacs to recognize function keys sent from ASCII | ||
| 3809 | terminals at any point in a key sequence. | ||
| 3810 | |||
| 3811 | The `read-key-sequence' function replaces any subsequence bound by | ||
| 3812 | `function-key-map' with its binding. More precisely, when the active | ||
| 3813 | keymaps have no binding for the current key sequence but | ||
| 3814 | `function-key-map' binds a suffix of the sequence to a vector or string, | ||
| 3815 | `read-key-sequence' replaces the matching suffix with its binding, and | ||
| 3816 | continues with the new sequence. | ||
| 3817 | |||
| 3818 | The events that come from bindings in `function-key-map' are not | ||
| 3819 | themselves looked up in `function-key-map'. | ||
| 3820 | |||
| 3821 | For example, suppose `function-key-map' binds `ESC O P' to [f1]. | ||
| 3822 | Typing `ESC O P' to `read-key-sequence' would return [f1]. Typing | ||
| 3823 | `C-x ESC O P' would return [?\\C-x f1]. If [f1] were a prefix | ||
| 3824 | key, typing `ESC O P x' would return [f1 x]. */); | ||
| 3825 | Vfunction_key_map = Fmake_sparse_keymap (Qnil); | ||
| 3826 | |||
| 3827 | DEFVAR_LISP ("key-translation-map", &Vkey_translation_map, | 3800 | DEFVAR_LISP ("key-translation-map", &Vkey_translation_map, |
| 3828 | doc: /* Keymap of key translations that can override keymaps. | 3801 | doc: /* Keymap of key translations that can override keymaps. |
| 3829 | This keymap works like `function-key-map', but comes after that, | 3802 | This keymap works like `function-key-map', but comes after that, |
diff --git a/src/term.c b/src/term.c index 774373e82f9..51d191a3bfc 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -1344,13 +1344,13 @@ term_get_fkeys_1 () | |||
| 1344 | 1344 | ||
| 1345 | /* This can happen if CANNOT_DUMP or with strange options. */ | 1345 | /* This can happen if CANNOT_DUMP or with strange options. */ |
| 1346 | if (!initialized) | 1346 | if (!initialized) |
| 1347 | Vfunction_key_map = Fmake_sparse_keymap (Qnil); | 1347 | current_kboard->Vfunction_key_map = Fmake_sparse_keymap (Qnil); |
| 1348 | 1348 | ||
| 1349 | for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++) | 1349 | for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++) |
| 1350 | { | 1350 | { |
| 1351 | char *sequence = tgetstr (keys[i].cap, address); | 1351 | char *sequence = tgetstr (keys[i].cap, address); |
| 1352 | if (sequence) | 1352 | if (sequence) |
| 1353 | Fdefine_key (Vfunction_key_map, build_string (sequence), | 1353 | Fdefine_key (current_kboard->Vfunction_key_map, build_string (sequence), |
| 1354 | Fmake_vector (make_number (1), | 1354 | Fmake_vector (make_number (1), |
| 1355 | intern (keys[i].name))); | 1355 | intern (keys[i].name))); |
| 1356 | } | 1356 | } |
| @@ -1370,13 +1370,13 @@ term_get_fkeys_1 () | |||
| 1370 | if (k0) | 1370 | if (k0) |
| 1371 | /* Define f0 first, so that f10 takes precedence in case the | 1371 | /* Define f0 first, so that f10 takes precedence in case the |
| 1372 | key sequences happens to be the same. */ | 1372 | key sequences happens to be the same. */ |
| 1373 | Fdefine_key (Vfunction_key_map, build_string (k0), | 1373 | Fdefine_key (current_kboard->Vfunction_key_map, build_string (k0), |
| 1374 | Fmake_vector (make_number (1), intern ("f0"))); | 1374 | Fmake_vector (make_number (1), intern ("f0"))); |
| 1375 | Fdefine_key (Vfunction_key_map, build_string (k_semi), | 1375 | Fdefine_key (current_kboard->Vfunction_key_map, build_string (k_semi), |
| 1376 | Fmake_vector (make_number (1), intern ("f10"))); | 1376 | Fmake_vector (make_number (1), intern ("f10"))); |
| 1377 | } | 1377 | } |
| 1378 | else if (k0) | 1378 | else if (k0) |
| 1379 | Fdefine_key (Vfunction_key_map, build_string (k0), | 1379 | Fdefine_key (current_kboard->Vfunction_key_map, build_string (k0), |
| 1380 | Fmake_vector (make_number (1), intern (k0_name))); | 1380 | Fmake_vector (make_number (1), intern (k0_name))); |
| 1381 | } | 1381 | } |
| 1382 | 1382 | ||
| @@ -1399,7 +1399,7 @@ term_get_fkeys_1 () | |||
| 1399 | if (sequence) | 1399 | if (sequence) |
| 1400 | { | 1400 | { |
| 1401 | sprintf (fkey, "f%d", i); | 1401 | sprintf (fkey, "f%d", i); |
| 1402 | Fdefine_key (Vfunction_key_map, build_string (sequence), | 1402 | Fdefine_key (current_kboard->Vfunction_key_map, build_string (sequence), |
| 1403 | Fmake_vector (make_number (1), | 1403 | Fmake_vector (make_number (1), |
| 1404 | intern (fkey))); | 1404 | intern (fkey))); |
| 1405 | } | 1405 | } |
| @@ -1416,7 +1416,7 @@ term_get_fkeys_1 () | |||
| 1416 | { \ | 1416 | { \ |
| 1417 | char *sequence = tgetstr (cap2, address); \ | 1417 | char *sequence = tgetstr (cap2, address); \ |
| 1418 | if (sequence) \ | 1418 | if (sequence) \ |
| 1419 | Fdefine_key (Vfunction_key_map, build_string (sequence), \ | 1419 | Fdefine_key (current_kboard->Vfunction_key_map, build_string (sequence), \ |
| 1420 | Fmake_vector (make_number (1), \ | 1420 | Fmake_vector (make_number (1), \ |
| 1421 | intern (sym))); \ | 1421 | intern (sym))); \ |
| 1422 | } | 1422 | } |