aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c43
-rw-r--r--src/keyboard.h9
-rw-r--r--src/keymap.c8
-rw-r--r--src/term.c14
4 files changed, 44 insertions, 30 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 7bdfa454636..d2d5919fc85 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -440,8 +440,11 @@ Lisp_Object Qpre_command_hook, Vpre_command_hook;
440Lisp_Object Qpost_command_hook, Vpost_command_hook; 440Lisp_Object Qpost_command_hook, Vpost_command_hook;
441Lisp_Object Qcommand_hook_internal, Vcommand_hook_internal; 441Lisp_Object Qcommand_hook_internal, Vcommand_hook_internal;
442 442
443/* Parent keymap of terminal-local function-key-map instances. */
444Lisp_Object Vfunction_key_map;
445
443/* Parent keymap of terminal-local key-translation-map instances. */ 446/* Parent keymap of terminal-local key-translation-map instances. */
444Lisp_Object Vglobal_key_translation_map; 447Lisp_Object Vkey_translation_map;
445 448
446/* List of deferred actions to be performed at a later time. 449/* List of deferred actions to be performed at a later time.
447 The precise format isn't relevant here; we just check whether it is nil. */ 450 The precise format isn't relevant here; we just check whether it is nil. */
@@ -8666,8 +8669,8 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8666 last_nonmenu_event = Qnil; 8669 last_nonmenu_event = Qnil;
8667 8670
8668 delayed_switch_frame = Qnil; 8671 delayed_switch_frame = Qnil;
8669 fkey.map = fkey.parent = current_kboard->Vfunction_key_map; 8672 fkey.map = fkey.parent = current_kboard->Vlocal_function_key_map;
8670 keytran.map = keytran.parent = current_kboard->Vkey_translation_map; 8673 keytran.map = keytran.parent = current_kboard->Vlocal_key_translation_map;
8671 /* If there is no translation-map, turn off scanning. */ 8674 /* If there is no translation-map, turn off scanning. */
8672 fkey.start = fkey.end = KEYMAPP (fkey.map) ? 0 : bufsize + 1; 8675 fkey.start = fkey.end = KEYMAPP (fkey.map) ? 0 : bufsize + 1;
8673 keytran.start = keytran.end = KEYMAPP (keytran.map) ? 0 : bufsize + 1; 8676 keytran.start = keytran.end = KEYMAPP (keytran.map) ? 0 : bufsize + 1;
@@ -10780,9 +10783,10 @@ init_kboard (kb)
10780 kb->reference_count = 0; 10783 kb->reference_count = 0;
10781 kb->Vsystem_key_alist = Qnil; 10784 kb->Vsystem_key_alist = Qnil;
10782 kb->system_key_syms = Qnil; 10785 kb->system_key_syms = Qnil;
10783 kb->Vfunction_key_map = Fmake_sparse_keymap (Qnil); 10786 kb->Vlocal_function_key_map = Fmake_sparse_keymap (Qnil);
10784 kb->Vkey_translation_map = Fmake_sparse_keymap (Qnil); 10787 Fset_keymap_parent (kb->Vlocal_function_key_map, Vfunction_key_map);
10785 Fset_keymap_parent (kb->Vkey_translation_map, Vglobal_key_translation_map); 10788 kb->Vlocal_key_translation_map = Fmake_sparse_keymap (Qnil);
10789 Fset_keymap_parent (kb->Vlocal_key_translation_map, Vkey_translation_map);
10786 kb->Vdefault_minibuffer_frame = Qnil; 10790 kb->Vdefault_minibuffer_frame = Qnil;
10787} 10791}
10788 10792
@@ -11496,7 +11500,7 @@ which binding of this variable is active at any given moment. If you
11496need set or get the binding on a specific display, use 11500need set or get the binding on a specific display, use
11497`terminal-local-value' and `set-terminal-local-value'. */); 11501`terminal-local-value' and `set-terminal-local-value'. */);
11498 11502
11499 DEFVAR_KBOARD ("function-key-map", Vfunction_key_map, 11503 DEFVAR_KBOARD ("local-function-key-map", Vlocal_function_key_map,
11500 doc: /* Keymap mapping ASCII function key sequences onto their preferred forms. 11504 doc: /* Keymap mapping ASCII function key sequences onto their preferred forms.
11501This allows Emacs to recognize function keys sent from ASCII 11505This allows Emacs to recognize function keys sent from ASCII
11502terminals at any point in a key sequence. 11506terminals at any point in a key sequence.
@@ -11517,14 +11521,22 @@ Typing `ESC O P' to `read-key-sequence' would return [f1]. Typing
11517key, typing `ESC O P x' would return [f1 x]. 11521key, typing `ESC O P x' would return [f1 x].
11518 11522
11519`function-key-map' has a separate binding for each display device. 11523`function-key-map' has a separate binding for each display device.
11520See Info node `(elisp)Multiple displays'. 11524See Info node `(elisp)Multiple displays'. If you need to define a
11525binding on all display devices, change `global-function-key-map'
11526instead.
11521 11527
11522Note that the currently selected frame has very little to do with 11528Note that the currently selected frame has very little to do with
11523which binding of this variable is active at any given moment. If you 11529which binding of this variable is active at any given moment. If you
11524need set or get the binding on a specific display, use 11530need set or get the binding on a specific display, use
11525`terminal-local-value' and `set-terminal-local-value'. */); 11531`terminal-local-value' and `set-terminal-local-value'. */);
11526 11532
11527 DEFVAR_KBOARD ("key-translation-map", Vkey_translation_map, 11533 DEFVAR_LISP ("function-key-map", &Vfunction_key_map,
11534 doc: /* The parent keymap of all `local-function-key-map' instances.
11535Function key definitions that apply to all display devices should go
11536here. */);
11537 Vfunction_key_map = Fmake_sparse_keymap (Qnil);
11538
11539 DEFVAR_KBOARD ("local-key-translation-map", Vlocal_key_translation_map,
11528 doc: /* Keymap of key translations that can override keymaps. 11540 doc: /* Keymap of key translations that can override keymaps.
11529This keymap works like `function-key-map', but comes after that, 11541This keymap works like `function-key-map', but comes after that,
11530and its non-prefix bindings override ordinary bindings. 11542and its non-prefix bindings override ordinary bindings.
@@ -11538,11 +11550,10 @@ which binding of this variable is active at any given moment. If you
11538need set or get the binding on a specific display, use 11550need set or get the binding on a specific display, use
11539`terminal-local-value' and `set-terminal-local-value'. */); 11551`terminal-local-value' and `set-terminal-local-value'. */);
11540 11552
11541 DEFVAR_LISP ("global-key-translation-map", &Vglobal_key_translation_map, 11553 DEFVAR_LISP ("key-translation-map", &Vkey_translation_map,
11542 doc: /* The parent keymap of all terminal-local `key-translation-map' instances. 11554 doc: /* The parent keymap of all `local-key-translation-map' instances.
11543Key translations that are not specific to a display device flavour 11555Key translations that apply to all display devices should go here. */);
11544should go here. */); 11556 Vkey_translation_map = Fmake_sparse_keymap (Qnil);
11545 Vglobal_key_translation_map = Fmake_sparse_keymap (Qnil);
11546 11557
11547 DEFVAR_LISP ("deferred-action-list", &Vdeferred_action_list, 11558 DEFVAR_LISP ("deferred-action-list", &Vdeferred_action_list,
11548 doc: /* List of deferred actions to be performed at a later time. 11559 doc: /* List of deferred actions to be performed at a later time.
@@ -11707,8 +11718,8 @@ mark_kboards ()
11707 mark_object (kb->Vlast_kbd_macro); 11718 mark_object (kb->Vlast_kbd_macro);
11708 mark_object (kb->Vsystem_key_alist); 11719 mark_object (kb->Vsystem_key_alist);
11709 mark_object (kb->system_key_syms); 11720 mark_object (kb->system_key_syms);
11710 mark_object (kb->Vfunction_key_map); 11721 mark_object (kb->Vlocal_function_key_map);
11711 mark_object (kb->Vkey_translation_map); 11722 mark_object (kb->Vlocal_key_translation_map);
11712 mark_object (kb->Vdefault_minibuffer_frame); 11723 mark_object (kb->Vdefault_minibuffer_frame);
11713 mark_object (kb->echo_string); 11724 mark_object (kb->echo_string);
11714 } 11725 }
diff --git a/src/keyboard.h b/src/keyboard.h
index 7710838c6e3..10b64dfe488 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -123,10 +123,10 @@ struct kboard
123 /* Keymap mapping ASCII function key sequences onto their 123 /* Keymap mapping ASCII function key sequences onto their
124 preferred forms. Initialized by the terminal-specific lisp 124 preferred forms. Initialized by the terminal-specific lisp
125 files. See the DEFVAR for more documentation. */ 125 files. See the DEFVAR for more documentation. */
126 Lisp_Object Vfunction_key_map; 126 Lisp_Object Vlocal_function_key_map;
127 127
128 /* Keymap of key translations that can override keymaps. */ 128 /* Keymap of key translations that can override keymaps. */
129 Lisp_Object Vkey_translation_map; 129 Lisp_Object Vlocal_key_translation_map;
130 130
131 /* Minibufferless frames on this display use this frame's minibuffer. */ 131 /* Minibufferless frames on this display use this frame's minibuffer. */
132 Lisp_Object Vdefault_minibuffer_frame; 132 Lisp_Object Vdefault_minibuffer_frame;
@@ -304,8 +304,11 @@ extern Lisp_Object read_char P_ ((int, int, Lisp_Object *, Lisp_Object, int *));
304/* User-supplied string to translate input characters through. */ 304/* User-supplied string to translate input characters through. */
305extern Lisp_Object Vkeyboard_translate_table; 305extern Lisp_Object Vkeyboard_translate_table;
306 306
307/* Parent keymap of terminal-local function-key-map instances. */
308extern Lisp_Object Vfunction_key_map;
309
307/* Parent keymap of terminal-local key-translation-map instances. */ 310/* Parent keymap of terminal-local key-translation-map instances. */
308extern Lisp_Object Vglobal_key_translation_map; 311extern Lisp_Object Vkey_translation_map;
309 312
310 313
311extern int parse_menu_item P_ ((Lisp_Object, int, int)); 314extern int parse_menu_item P_ ((Lisp_Object, int, int));
diff --git a/src/keymap.c b/src/keymap.c
index b9247122ccd..17c55cfd2d6 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -2841,8 +2841,8 @@ You type Translation\n\
2841 insert ("\n", 1); 2841 insert ("\n", 1);
2842 } 2842 }
2843 2843
2844 if (!NILP (current_kboard->Vkey_translation_map)) 2844 if (!NILP (current_kboard->Vlocal_key_translation_map))
2845 describe_map_tree (current_kboard->Vkey_translation_map, 0, Qnil, prefix, 2845 describe_map_tree (current_kboard->Vlocal_key_translation_map, 0, Qnil, prefix,
2846 "Key translations", nomenu, 1, 0, 0); 2846 "Key translations", nomenu, 1, 0, 0);
2847 2847
2848 2848
@@ -2931,8 +2931,8 @@ You type Translation\n\
2931 "\f\nGlobal Bindings", nomenu, 0, 1, 0); 2931 "\f\nGlobal Bindings", nomenu, 0, 1, 0);
2932 2932
2933 /* Print the function-key-map translations under this prefix. */ 2933 /* Print the function-key-map translations under this prefix. */
2934 if (!NILP (current_kboard->Vfunction_key_map)) 2934 if (!NILP (current_kboard->Vlocal_function_key_map))
2935 describe_map_tree (current_kboard->Vfunction_key_map, 0, Qnil, prefix, 2935 describe_map_tree (current_kboard->Vlocal_function_key_map, 0, Qnil, prefix,
2936 "\f\nFunction key map translations", nomenu, 1, 0, 0); 2936 "\f\nFunction key map translations", nomenu, 1, 0, 0);
2937 2937
2938 UNGCPRO; 2938 UNGCPRO;
diff --git a/src/term.c b/src/term.c
index 14396a0c1d2..e340edb6c17 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1350,13 +1350,13 @@ term_get_fkeys_1 ()
1350 1350
1351 /* This can happen if CANNOT_DUMP or with strange options. */ 1351 /* This can happen if CANNOT_DUMP or with strange options. */
1352 if (!initialized) 1352 if (!initialized)
1353 kboard->Vfunction_key_map = Fmake_sparse_keymap (Qnil); 1353 kboard->Vlocal_function_key_map = Fmake_sparse_keymap (Qnil);
1354 1354
1355 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++) 1355 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++)
1356 { 1356 {
1357 char *sequence = tgetstr (keys[i].cap, address); 1357 char *sequence = tgetstr (keys[i].cap, address);
1358 if (sequence) 1358 if (sequence)
1359 Fdefine_key (kboard->Vfunction_key_map, build_string (sequence), 1359 Fdefine_key (kboard->Vlocal_function_key_map, build_string (sequence),
1360 Fmake_vector (make_number (1), 1360 Fmake_vector (make_number (1),
1361 intern (keys[i].name))); 1361 intern (keys[i].name)));
1362 } 1362 }
@@ -1376,13 +1376,13 @@ term_get_fkeys_1 ()
1376 if (k0) 1376 if (k0)
1377 /* Define f0 first, so that f10 takes precedence in case the 1377 /* Define f0 first, so that f10 takes precedence in case the
1378 key sequences happens to be the same. */ 1378 key sequences happens to be the same. */
1379 Fdefine_key (kboard->Vfunction_key_map, build_string (k0), 1379 Fdefine_key (kboard->Vlocal_function_key_map, build_string (k0),
1380 Fmake_vector (make_number (1), intern ("f0"))); 1380 Fmake_vector (make_number (1), intern ("f0")));
1381 Fdefine_key (kboard->Vfunction_key_map, build_string (k_semi), 1381 Fdefine_key (kboard->Vlocal_function_key_map, build_string (k_semi),
1382 Fmake_vector (make_number (1), intern ("f10"))); 1382 Fmake_vector (make_number (1), intern ("f10")));
1383 } 1383 }
1384 else if (k0) 1384 else if (k0)
1385 Fdefine_key (kboard->Vfunction_key_map, build_string (k0), 1385 Fdefine_key (kboard->Vlocal_function_key_map, build_string (k0),
1386 Fmake_vector (make_number (1), intern (k0_name))); 1386 Fmake_vector (make_number (1), intern (k0_name)));
1387 } 1387 }
1388 1388
@@ -1405,7 +1405,7 @@ term_get_fkeys_1 ()
1405 if (sequence) 1405 if (sequence)
1406 { 1406 {
1407 sprintf (fkey, "f%d", i); 1407 sprintf (fkey, "f%d", i);
1408 Fdefine_key (kboard->Vfunction_key_map, build_string (sequence), 1408 Fdefine_key (kboard->Vlocal_function_key_map, build_string (sequence),
1409 Fmake_vector (make_number (1), 1409 Fmake_vector (make_number (1),
1410 intern (fkey))); 1410 intern (fkey)));
1411 } 1411 }
@@ -1422,7 +1422,7 @@ term_get_fkeys_1 ()
1422 { \ 1422 { \
1423 char *sequence = tgetstr (cap2, address); \ 1423 char *sequence = tgetstr (cap2, address); \
1424 if (sequence) \ 1424 if (sequence) \
1425 Fdefine_key (kboard->Vfunction_key_map, build_string (sequence), \ 1425 Fdefine_key (kboard->Vlocal_function_key_map, build_string (sequence), \
1426 Fmake_vector (make_number (1), \ 1426 Fmake_vector (make_number (1), \
1427 intern (sym))); \ 1427 intern (sym))); \
1428 } 1428 }