diff options
Diffstat (limited to 'src/keymap.c')
| -rw-r--r-- | src/keymap.c | 56 |
1 files changed, 9 insertions, 47 deletions
diff --git a/src/keymap.c b/src/keymap.c index dbcf1d6fcfd..47e3f50786b 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -31,6 +31,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 31 | #include "buffer.h" | 31 | #include "buffer.h" |
| 32 | #include "charset.h" | 32 | #include "charset.h" |
| 33 | #include "keyboard.h" | 33 | #include "keyboard.h" |
| 34 | #include "frame.h" | ||
| 34 | #include "termhooks.h" | 35 | #include "termhooks.h" |
| 35 | #include "blockinput.h" | 36 | #include "blockinput.h" |
| 36 | #include "puresize.h" | 37 | #include "puresize.h" |
| @@ -90,14 +91,6 @@ Lisp_Object Vminor_mode_overriding_map_alist; | |||
| 90 | /* List of emulation mode keymap alists. */ | 91 | /* List of emulation mode keymap alists. */ |
| 91 | Lisp_Object Vemulation_mode_map_alists; | 92 | Lisp_Object Vemulation_mode_map_alists; |
| 92 | 93 | ||
| 93 | /* Keymap mapping ASCII function key sequences onto their preferred forms. | ||
| 94 | Initialized by the terminal-specific lisp files. See DEFVAR for more | ||
| 95 | documentation. */ | ||
| 96 | Lisp_Object Vfunction_key_map; | ||
| 97 | |||
| 98 | /* Keymap mapping ASCII function key sequences onto their preferred forms. */ | ||
| 99 | Lisp_Object Vkey_translation_map; | ||
| 100 | |||
| 101 | /* A list of all commands given new bindings since a certain time | 94 | /* A list of all commands given new bindings since a certain time |
| 102 | when nil was stored here. | 95 | when nil was stored here. |
| 103 | This is used to speed up recomputation of menu key equivalents | 96 | This is used to speed up recomputation of menu key equivalents |
| @@ -3021,11 +3014,11 @@ You type Translation\n\ | |||
| 3021 | outbuf = Fcurrent_buffer (); | 3014 | outbuf = Fcurrent_buffer (); |
| 3022 | 3015 | ||
| 3023 | /* Report on alternates for keys. */ | 3016 | /* Report on alternates for keys. */ |
| 3024 | if (STRINGP (Vkeyboard_translate_table) && !NILP (prefix)) | 3017 | if (STRINGP (current_kboard->Vkeyboard_translate_table) && !NILP (prefix)) |
| 3025 | { | 3018 | { |
| 3026 | int c; | 3019 | int c; |
| 3027 | const unsigned char *translate = SDATA (Vkeyboard_translate_table); | 3020 | const unsigned char *translate = SDATA (current_kboard->Vkeyboard_translate_table); |
| 3028 | int translate_len = SCHARS (Vkeyboard_translate_table); | 3021 | int translate_len = SCHARS (current_kboard->Vkeyboard_translate_table); |
| 3029 | 3022 | ||
| 3030 | for (c = 0; c < translate_len; c++) | 3023 | for (c = 0; c < translate_len; c++) |
| 3031 | if (translate[c] != c) | 3024 | if (translate[c] != c) |
| @@ -3048,14 +3041,14 @@ You type Translation\n\ | |||
| 3048 | insert ("\n", 1); | 3041 | insert ("\n", 1); |
| 3049 | 3042 | ||
| 3050 | /* Insert calls signal_after_change which may GC. */ | 3043 | /* Insert calls signal_after_change which may GC. */ |
| 3051 | translate = SDATA (Vkeyboard_translate_table); | 3044 | translate = SDATA (current_kboard->Vkeyboard_translate_table); |
| 3052 | } | 3045 | } |
| 3053 | 3046 | ||
| 3054 | insert ("\n", 1); | 3047 | insert ("\n", 1); |
| 3055 | } | 3048 | } |
| 3056 | 3049 | ||
| 3057 | if (!NILP (Vkey_translation_map)) | 3050 | if (!NILP (current_kboard->Vlocal_key_translation_map)) |
| 3058 | describe_map_tree (Vkey_translation_map, 0, Qnil, prefix, | 3051 | describe_map_tree (current_kboard->Vlocal_key_translation_map, 0, Qnil, prefix, |
| 3059 | "Key translations", nomenu, 1, 0, 0); | 3052 | "Key translations", nomenu, 1, 0, 0); |
| 3060 | 3053 | ||
| 3061 | 3054 | ||
| @@ -3144,8 +3137,8 @@ You type Translation\n\ | |||
| 3144 | "\f\nGlobal Bindings", nomenu, 0, 1, 0); | 3137 | "\f\nGlobal Bindings", nomenu, 0, 1, 0); |
| 3145 | 3138 | ||
| 3146 | /* Print the function-key-map translations under this prefix. */ | 3139 | /* Print the function-key-map translations under this prefix. */ |
| 3147 | if (!NILP (Vfunction_key_map)) | 3140 | if (!NILP (current_kboard->Vlocal_function_key_map)) |
| 3148 | describe_map_tree (Vfunction_key_map, 0, Qnil, prefix, | 3141 | describe_map_tree (current_kboard->Vlocal_function_key_map, 0, Qnil, prefix, |
| 3149 | "\f\nFunction key map translations", nomenu, 1, 0, 0); | 3142 | "\f\nFunction key map translations", nomenu, 1, 0, 0); |
| 3150 | 3143 | ||
| 3151 | UNGCPRO; | 3144 | UNGCPRO; |
| @@ -4115,37 +4108,6 @@ the same way. The "active" keymaps in each alist are used before | |||
| 4115 | `minor-mode-map-alist' and `minor-mode-overriding-map-alist'. */); | 4108 | `minor-mode-map-alist' and `minor-mode-overriding-map-alist'. */); |
| 4116 | Vemulation_mode_map_alists = Qnil; | 4109 | Vemulation_mode_map_alists = Qnil; |
| 4117 | 4110 | ||
| 4118 | |||
| 4119 | DEFVAR_LISP ("function-key-map", &Vfunction_key_map, | ||
| 4120 | doc: /* Keymap that translates key sequences to key sequences during input. | ||
| 4121 | This is used mainly for mapping ASCII function key sequences into | ||
| 4122 | real Emacs function key events (symbols). | ||
| 4123 | |||
| 4124 | The `read-key-sequence' function replaces any subsequence bound by | ||
| 4125 | `function-key-map' with its binding. More precisely, when the active | ||
| 4126 | keymaps have no binding for the current key sequence but | ||
| 4127 | `function-key-map' binds a suffix of the sequence to a vector or string, | ||
| 4128 | `read-key-sequence' replaces the matching suffix with its binding, and | ||
| 4129 | continues with the new sequence. | ||
| 4130 | |||
| 4131 | If the binding is a function, it is called with one argument (the prompt) | ||
| 4132 | and its return value (a key sequence) is used. | ||
| 4133 | |||
| 4134 | The events that come from bindings in `function-key-map' are not | ||
| 4135 | themselves looked up in `function-key-map'. | ||
| 4136 | |||
| 4137 | For example, suppose `function-key-map' binds `ESC O P' to [f1]. | ||
| 4138 | Typing `ESC O P' to `read-key-sequence' would return [f1]. Typing | ||
| 4139 | `C-x ESC O P' would return [?\\C-x f1]. If [f1] were a prefix | ||
| 4140 | key, typing `ESC O P x' would return [f1 x]. */); | ||
| 4141 | Vfunction_key_map = Fmake_sparse_keymap (Qnil); | ||
| 4142 | |||
| 4143 | DEFVAR_LISP ("key-translation-map", &Vkey_translation_map, | ||
| 4144 | doc: /* Keymap of key translations that can override keymaps. | ||
| 4145 | This keymap works like `function-key-map', but comes after that, | ||
| 4146 | and its non-prefix bindings override ordinary bindings. */); | ||
| 4147 | Vkey_translation_map = Qnil; | ||
| 4148 | |||
| 4149 | staticpro (&Vmouse_events); | 4111 | staticpro (&Vmouse_events); |
| 4150 | Vmouse_events = Fcons (intern ("menu-bar"), | 4112 | Vmouse_events = Fcons (intern ("menu-bar"), |
| 4151 | Fcons (intern ("tool-bar"), | 4113 | Fcons (intern ("tool-bar"), |