From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: New input translation map Date: Wed, 03 Oct 2007 17:44:03 -0400 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1191447934 12273 80.91.229.12 (3 Oct 2007 21:45:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 3 Oct 2007 21:45:34 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 03 23:45:31 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IdC1t-00073o-Mw for ged-emacs-devel@m.gmane.org; Wed, 03 Oct 2007 23:45:19 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IdC1p-0007Jp-5j for ged-emacs-devel@m.gmane.org; Wed, 03 Oct 2007 17:45:13 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IdC1b-0007AS-5H for emacs-devel@gnu.org; Wed, 03 Oct 2007 17:44:59 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IdC1Z-00079e-T1 for emacs-devel@gnu.org; Wed, 03 Oct 2007 17:44:58 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IdC1Z-00079Y-M2 for emacs-devel@gnu.org; Wed, 03 Oct 2007 17:44:57 -0400 Original-Received: from [145.253.90.146] (helo=ceviche.home) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IdC1X-0003yE-KM for emacs-devel@gnu.org; Wed, 03 Oct 2007 17:44:57 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 43226B40BB; Wed, 3 Oct 2007 17:44:03 -0400 (EDT) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) X-Detected-Kernel: Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:80207 Archived-At: In some past discussion we reached an agreement that most of the escape-sequence processing as well as the keyboard-coding-system processing should not take place in function-key-map (because the processing should not depend on whether the sequence is bound in the main keymaps) nor in key-translation-map (because that's too late and prevents the decoded event from passing through function-key-map and key-translation-map) but in some earlier step instead. So the patch below implements just that: a new input translation map, which I called `input-decode-map' which takes place before function-key-map and applies the translations regardless of whether the untranslated events correspond to a binding in the global maps. encoded-kb.el is changed to use that feature, and since encoded-kb was the only one to use the new local-key-translation-map, I think it's a good opportunity to remove the new local-key-translation-map that was introduced in multi-tty specifically for encoded-kb.el (I'd also happily mark key-translation-map as obsolete, but let's concentrate on the more serious issue for now). Any objection? Stefan --- keyboard.h 29 ao=FB 2007 22:33:12 -0400 1.78 +++ keyboard.h 03 oct 2007 17:30:59 -0400=09 @@ -127,13 +127,14 @@ /* Cache for modify_event_symbol. */ Lisp_Object system_key_syms; =20 - /* Keymap mapping ASCII function key sequences onto their - preferred forms. Initialized by the terminal-specific lisp - files. See the DEFVAR for more documentation. */ + /* Keymap mapping keys to alternative preferred forms. + See the DEFVAR for more documentation. */ Lisp_Object Vlocal_function_key_map; =20=20=20=20=20 - /* Keymap of key translations that can override keymaps. */ - Lisp_Object Vlocal_key_translation_map; + /* Keymap mapping ASCII function key sequences onto their preferred + forms. Initialized by the terminal-specific lisp files. See the + DEFVAR for more documentation. */ + Lisp_Object Vinput_decode_map; =20 /* Minibufferless frames on this display use this frame's minibuffer. = */ Lisp_Object Vdefault_minibuffer_frame; @@ -314,7 +315,7 @@ /* Parent keymap of terminal-local function-key-map instances. */ extern Lisp_Object Vfunction_key_map; =20 -/* Parent keymap of terminal-local key-translation-map instances. */ +/* Keymap of key translations that can override keymaps. */ extern Lisp_Object Vkey_translation_map; =20 extern int parse_menu_item P_ ((Lisp_Object, int, int)); --- keyboard.c 27 sep 2007 14:23:39 -0400 1.916 +++ keyboard.c 03 oct 2007 17:39:06 -0400=09 @@ -445,7 +445,7 @@ /* Parent keymap of terminal-local function-key-map instances. */ Lisp_Object Vfunction_key_map; =20 -/* Parent keymap of terminal-local key-translation-map instances. */ +/* Keymap of key translations that can override keymaps. */ Lisp_Object Vkey_translation_map; =20 /* List of deferred actions to be performed at a later time. @@ -9131,8 +9131,8 @@ key's again in Vfunction_key_map. */ volatile keyremap fkey; =20 - /* Likewise, for key_translation_map. */ - volatile keyremap keytran; + /* Likewise, for key_translation_map and input-decode-map. */ + volatile keyremap keytran, indec; =20 /* If we receive a `switch-frame' or `select-window' event in the middle= of a key sequence, we put it off for later. @@ -9209,8 +9209,10 @@ =20 /* We may switch keyboards between rescans, so we need to reinitialize fkey and keytran before each replay. */ + indec.map =3D indec.parent =3D current_kboard->Vinput_decode_map; fkey.map =3D fkey.parent =3D current_kboard->Vlocal_function_key_map; - keytran.map =3D keytran.parent =3D current_kboard->Vlocal_key_translatio= n_map; + keytran.map =3D keytran.parent =3D Vkey_translation_map; + indec.start =3D indec.end =3D 0; fkey.start =3D fkey.end =3D 0; keytran.start =3D keytran.end =3D 0; =20 @@ -9299,7 +9301,7 @@ Thus, if ESC O a has a function-key-map translation and ESC o has a binding, don't return after ESC O, so that we can translate ESC O plus the next character. */ - : (fkey.start < t || keytran.start < t)) + : (/* indec.start < t || fkey.start < t || */ keytran.start < t)) { Lisp_Object key; int used_mouse_menu =3D 0; @@ -9317,13 +9319,17 @@ just one key. */ volatile int echo_local_start, keys_local_start, local_first_binding; =20 - eassert (fkey.end =3D=3D t || (fkey.end > t && fkey.end <=3D mock_in= put)); + eassert (indec.end =3D=3D t || (indec.end > t && indec.end <=3D mock= _input)); + eassert (indec.start <=3D indec.end); eassert (fkey.start <=3D fkey.end); eassert (keytran.start <=3D keytran.end); - /* key-translation-map is applied *after* function-key-map. */ + /* key-translation-map is applied *after* function-key-map + which is itself applied *after* input-decode-map. */ + eassert (fkey.end <=3D indec.start); eassert (keytran.end <=3D fkey.start); =20 - if (first_unbound < fkey.start && first_unbound < keytran.start) + if (/* first_unbound < indec.start && first_unbound < fkey.start && = */ + first_unbound < keytran.start) { /* The prefix upto first_unbound has no binding and has no translation left to do either, so we know it's unbound. If we don't stop now, we risk staying here indefinitely @@ -9333,6 +9339,8 @@ for (i =3D first_unbound + 1; i < t; i++) keybuf[i - first_unbound - 1] =3D keybuf[i]; mock_input =3D t - first_unbound - 1; + indec.end =3D indec.start -=3D first_unbound + 1; + indec.map =3D indec.parent; fkey.end =3D fkey.start -=3D first_unbound + 1; fkey.map =3D fkey.parent; keytran.end =3D keytran.start -=3D first_unbound + 1; @@ -9758,15 +9766,15 @@ /* This is needed for the following scenario: event 0: a down-event that gets dropped by calling replay_key. event 1: some normal prefix like C-h. - After event 0, first_unbound is 0, after event 1 fkey.start - and keytran.start are both 1, so when we see that C-h is bound, - we need to update first_unbound. */ + After event 0, first_unbound is 0, after event 1 indec.start, + fkey.start, and keytran.start are all 1, so when we see that + C-h is bound, we need to update first_unbound. */ first_unbound =3D max (t + 1, first_unbound); else { Lisp_Object head; =20 - /* Remember the position to put an upper bound on fkey.start. */ + /* Remember the position to put an upper bound on indec.start. */ first_unbound =3D min (t, first_unbound); =20 head =3D EVENT_HEAD (key); @@ -9851,11 +9859,16 @@ /* If mock_input > t + 1, the above simplification will actually end up dropping keys on the floor. This is probably OK for now, but even - if mock_input <=3D t + 1, we need to adjust fkey - and keytran. + if mock_input <=3D t + 1, we need to adjust indec, + fkey, and keytran. Typical case [header-line down-mouse-N]: mock_input =3D 2, t =3D 1, fkey.end =3D 1, last_real_key_start =3D 0. */ + if (indec.end > last_real_key_start) + { + indec.end =3D indec.start + =3D min (last_real_key_start, indec.start); + indec.map =3D indec.parent; if (fkey.end > last_real_key_start) { fkey.end =3D fkey.start @@ -9868,6 +9881,7 @@ keytran.map =3D keytran.parent; } } + } if (t =3D=3D last_real_key_start) { mock_input =3D 0; @@ -9919,8 +9933,28 @@ /* Record what part of this_command_keys is the current key sequence= . */ this_single_command_key_start =3D this_command_key_count - t; =20 - if (first_binding < nmaps && NILP (submaps[first_binding])) + /* Look for this sequence in input-decode-map. + Scan from indec.end until we find a bound suffix. */ + while (indec.end < t) + { + struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; + int done, diff; + + GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame); + done =3D keyremap_step (keybuf, bufsize, &indec, max (t, mock_input), + 1, &diff, prompt); + UNGCPRO; + if (done) + { + mock_input =3D diff + max (t, mock_input); + goto replay_sequence; + } + } + + if (first_binding < nmaps && NILP (submaps[first_binding]) + && indec.start >=3D t) /* There is a binding and it's not a prefix. + (and it doesn't have any input-decode-map translation pending). There is thus no function-key in this sequence. Moving fkey.start is important in this case to allow keytran.start to go over the sequence before we return (since we keep the @@ -9933,12 +9967,12 @@ /* If the sequence is unbound, see if we can hang a function key off the end of it. */ /* Continue scan from fkey.end until we find a bound suffix. */ - while (fkey.end < t) + while (fkey.end < indec.start) { - struct gcpro gcpro1, gcpro2, gcpro3; + struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; int done, diff; =20 - GCPRO3 (fkey.map, keytran.map, delayed_switch_frame); + GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame); done =3D keyremap_step (keybuf, bufsize, &fkey, max (t, mock_input), /* If there's a binding (i.e. @@ -9950,6 +9984,10 @@ if (done) { mock_input =3D diff + max (t, mock_input); + /* Adjust the input-decode-map counters. */ + indec.end +=3D diff; + indec.start +=3D diff; + goto replay_sequence; } } @@ -9958,17 +9996,19 @@ Scan from keytran.end until we find a bound suffix. */ while (keytran.end < fkey.start) { - struct gcpro gcpro1, gcpro2, gcpro3; + struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; int done, diff; =20 - GCPRO3 (fkey.map, keytran.map, delayed_switch_frame); + GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame); done =3D keyremap_step (keybuf, bufsize, &keytran, max (t, mock_input), 1, &diff, prompt); UNGCPRO; if (done) { mock_input =3D diff + max (t, mock_input); - /* Adjust the function-key-map counters. */ + /* Adjust the function-key-map and input-decode-map counters. */ + indec.end +=3D diff; + indec.start +=3D diff; fkey.end +=3D diff; fkey.start +=3D diff; =20 @@ -9981,7 +10021,7 @@ and is an upper case letter use the corresponding lower-case letter instead. */ if (first_binding >=3D nmaps - && fkey.start >=3D t && keytran.start >=3D t + && /* indec.start >=3D t && fkey.start >=3D t && */ keytran.start >=3D t && INTEGERP (key) && ((((XINT (key) & 0x3ffff) < XCHAR_TABLE (current_buffer->downcase_table)->size) @@ -10012,7 +10052,7 @@ and is a shifted function key, use the corresponding unshifted function key instead. */ if (first_binding >=3D nmaps - && fkey.start >=3D t && keytran.start >=3D t + && /* indec.start >=3D t && fkey.start >=3D t && */ keytran.start >=3D t && SYMBOLP (key)) { Lisp_Object breakdown; @@ -10033,9 +10073,6 @@ =20 keybuf[t - 1] =3D new_key; mock_input =3D max (t, mock_input); - fkey.start =3D fkey.end =3D 0; - keytran.start =3D keytran.end =3D 0; - goto replay_sequence; } } @@ -11460,10 +11497,9 @@ kb->reference_count =3D 0; kb->Vsystem_key_alist =3D Qnil; kb->system_key_syms =3D Qnil; + kb->Vinput_decode_map =3D Fmake_sparse_keymap (Qnil); kb->Vlocal_function_key_map =3D Fmake_sparse_keymap (Qnil); Fset_keymap_parent (kb->Vlocal_function_key_map, Vfunction_key_map); - kb->Vlocal_key_translation_map =3D Fmake_sparse_keymap (Qnil); - Fset_keymap_parent (kb->Vlocal_key_translation_map, Vkey_translation_map= ); kb->Vdefault_minibuffer_frame =3D Qnil; } =20 @@ -12196,8 +12232,8 @@ =20 DEFVAR_KBOARD ("local-function-key-map", Vlocal_function_key_map, doc: /* Keymap that translates key sequences to key seque= nces during input. -This is used mainly for mapping ASCII function key sequences into -real Emacs function key events (symbols). +This is used mainly for mapping key sequences into some preferred +key events (symbols). =20 The `read-key-sequence' function replaces any subsequence bound by `local-function-key-map' with its binding. More precisely, when the @@ -12223,6 +12259,25 @@ instead. Initially, `local-function-key-map' is an empty keymap that has `function-key-map' as its parent on all terminal devices. */); =20 + DEFVAR_KBOARD ("input-decode-map", Vinput_decode_map, + doc: /* Keymap that decodes input escape sequences. +This is used mainly for mapping ASCII function key sequences into +real Emacs function key events (symbols). + +The `read-key-sequence' function replaces any subsequence bound by +`local-function-key-map' with its binding. Contrary to `function-key-map', +this map applies its rebinding regardless of the presence of an ordinary +binding. So it is more like `key-translation-map' except that it applies +before `function-key-map' rather than after. + +If the binding is a function, it is called with one argument (the prompt) +and its return value (a key sequence) is used. + +The events that come from bindings in `input-decode-map' are not +themselves looked up in `input-decode-map'. + +This variable is keyboard-local. */); + DEFVAR_LISP ("function-key-map", &Vfunction_key_map, doc: /* The parent keymap of all `local-function-key-map' i= nstances. Function key definitions that apply to all terminal devices should go @@ -12231,18 +12286,11 @@ definition will take precendence. */); Vfunction_key_map =3D Fmake_sparse_keymap (Qnil); =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 - DEFVAR_KBOARD ("local-key-translation-map", Vlocal_key_translation_map, + DEFVAR_LISP ("key-translation-map", &Vkey_translation_map, doc: /* Keymap of key translations that can override keymaps. This keymap works like `function-key-map', but comes after that, and its non-prefix bindings override ordinary bindings. - -`key-translation-map' has a separate binding for each terminal device. -(See Info node `(elisp)Multiple displays'.) If you need to set a key -translation on all terminals, change `global-key-translation-map' instead.= */); - - DEFVAR_LISP ("key-translation-map", &Vkey_translation_map, - doc: /* The parent keymap of all `local-key-translation-map= ' instances. -Key translations that apply to all terminal devices should go here. */); +Another difference is that it is global rather than keyboard-local. */); Vkey_translation_map =3D Fmake_sparse_keymap (Qnil); =20 DEFVAR_LISP ("deferred-action-list", &Vdeferred_action_list, @@ -12420,8 +12468,8 @@ mark_object (kb->Vlast_kbd_macro); mark_object (kb->Vsystem_key_alist); mark_object (kb->system_key_syms); + mark_object (kb->Vinput_decode_map); mark_object (kb->Vlocal_function_key_map); - mark_object (kb->Vlocal_key_translation_map); mark_object (kb->Vdefault_minibuffer_frame); mark_object (kb->echo_string); } --- keymap.c 29 ao=FB 2007 22:33:12 -0400 1.361 +++ keymap.c 03 oct 2007 06:56:58 -0400=09 @@ -3027,8 +3027,8 @@ insert ("\n", 1); } =20 - if (!NILP (current_kboard->Vlocal_key_translation_map)) - describe_map_tree (current_kboard->Vlocal_key_translation_map, 0, Qnil= , prefix, + if (!NILP (Vkey_translation_map)) + describe_map_tree (Vkey_translation_map, 0, Qnil, prefix, "Key translations", nomenu, 1, 0, 0); =20 =20 @@ -3121,6 +3121,11 @@ describe_map_tree (current_kboard->Vlocal_function_key_map, 0, Qnil, p= refix, "\f\nFunction key map translations", nomenu, 1, 0, 0); =20 + /* Print the input-decode-map translations under this prefix. */ + if (!NILP (current_kboard->Vinput_decode_map)) + describe_map_tree (current_kboard->Vinput_decode_map, 0, Qnil, prefix, + "\f\nInput decoding map translations", nomenu, 1, 0, 0); + UNGCPRO; return Qnil; } --- term.c 29 sep 2007 16:37:53 -0400 1.207 +++ term.c 03 oct 2007 07:25:16 -0400=09 @@ -1274,9 +1274,9 @@ static KBOARD *term_get_fkeys_kboard; static Lisp_Object term_get_fkeys_1 (); =20 -/* Find the escape codes sent by the function keys for Vfunction_key_map. +/* Find the escape codes sent by the function keys for Vinput_decode_map. This function scans the termcap function key sequence entries, and - adds entries to Vfunction_key_map for each function key it finds. */ + adds entries to Vinput_decode_map for each function key it finds. */ =20 static void term_get_fkeys (address, kboard) @@ -1306,14 +1306,14 @@ KBOARD *kboard =3D term_get_fkeys_kboard; =20=20=20 /* This can happen if CANNOT_DUMP or with strange options. */ - if (!initialized) - kboard->Vlocal_function_key_map =3D Fmake_sparse_keymap (Qnil); + if (!KEYMAPP (kboard->Vinput_decode_map)) + kboard->Vinput_decode_map =3D Fmake_sparse_keymap (Qnil); =20 for (i =3D 0; i < (sizeof (keys)/sizeof (keys[0])); i++) { char *sequence =3D tgetstr (keys[i].cap, address); if (sequence) - Fdefine_key (kboard->Vlocal_function_key_map, build_string (sequence), + Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), Fmake_vector (make_number (1), intern (keys[i].name))); } @@ -1333,13 +1333,13 @@ if (k0) /* Define f0 first, so that f10 takes precedence in case the key sequences happens to be the same. */ - Fdefine_key (kboard->Vlocal_function_key_map, build_string (k0), + Fdefine_key (kboard->Vinput_decode_map, build_string (k0), Fmake_vector (make_number (1), intern ("f0"))); - Fdefine_key (kboard->Vlocal_function_key_map, build_string (k_semi), + Fdefine_key (kboard->Vinput_decode_map, build_string (k_semi), Fmake_vector (make_number (1), intern ("f10"))); } else if (k0) - Fdefine_key (kboard->Vlocal_function_key_map, build_string (k0), + Fdefine_key (kboard->Vinput_decode_map, build_string (k0), Fmake_vector (make_number (1), intern (k0_name))); } =20 @@ -1362,7 +1362,7 @@ if (sequence) { sprintf (fkey, "f%d", i); - Fdefine_key (kboard->Vlocal_function_key_map, build_string (sequenc= e), + Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), Fmake_vector (make_number (1), intern (fkey))); } @@ -1379,7 +1379,7 @@ { \ char *sequence =3D tgetstr (cap2, address); \ if (sequence) \ - Fdefine_key (kboard->Vlocal_function_key_map, build_string (sequence)= , \ + Fdefine_key (kboard->Vinput_decode_map, build_string (sequence), \ Fmake_vector (make_number (1), \ intern (sym))); \ } --- xterm.el 16 sep 2007 18:05:52 -0400 1.49 +++ xterm.el 03 oct 2007 17:10:35 -0400=09 @@ -375,6 +375,72 @@ map) "Function key map overrides for xterm.") =20 +(defvar xterm-alternatives-map + (let ((map (make-sparse-keymap))) + ;; The terminal initialization C code file might have initialized + ;; function keys F13->F60 from the termcap/terminfo information. + ;; On a PC-style keyboard these keys correspond to + ;; MODIFIER-FUNCTION_KEY, where modifier is S-, C, A-, C-S-. The code + ;; here substitutes the corresponding definitions in function-key-map. + ;; The mapping from escape sequences to Fn is done in input-decode-map + ;; whereas this here mapping is done in local-function-key-map so that + ;; bindings to f45 still work, in case your keyboard really has an f45 + ;; key rather than C-S-f9. + (define-key map [f13] [S-f1]) + (define-key map [f14] [S-f2]) + (define-key map [f15] [S-f3]) + (define-key map [f16] [S-f4]) + (define-key map [f17] [S-f5]) + (define-key map [f18] [S-f6]) + (define-key map [f19] [S-f7]) + (define-key map [f20] [S-f8]) + (define-key map [f21] [S-f9]) + (define-key map [f22] [S-f10]) + (define-key map [f23] [S-f11]) + (define-key map [f24] [S-f12]) + + (define-key map [f25] [C-f1]) + (define-key map [f26] [C-f2]) + (define-key map [f27] [C-f3]) + (define-key map [f28] [C-f4]) + (define-key map [f29] [C-f5]) + (define-key map [f30] [C-f6]) + (define-key map [f31] [C-f7]) + (define-key map [f32] [C-f8]) + (define-key map [f33] [C-f9]) + (define-key map [f34] [C-f10]) + (define-key map [f35] [C-f11]) + (define-key map [f36] [C-f12]) + + (define-key map [f37] [C-S-f1]) + (define-key map [f38] [C-S-f2]) + (define-key map [f39] [C-S-f3]) + (define-key map [f40] [C-S-f4]) + (define-key map [f41] [C-S-f5]) + (define-key map [f42] [C-S-f6]) + (define-key map [f43] [C-S-f7]) + (define-key map [f44] [C-S-f8]) + (define-key map [f45] [C-S-f9]) + (define-key map [f46] [C-S-f10]) + (define-key map [f47] [C-S-f11]) + (define-key map [f48] [C-S-f12]) + + (define-key map [f49] [A-f1]) + (define-key map [f50] [A-f2]) + (define-key map [f51] [A-f3]) + (define-key map [f52] [A-f4]) + (define-key map [f53] [A-f5]) + (define-key map [f54] [A-f6]) + (define-key map [f55] [A-f7]) + (define-key map [f56] [A-f8]) + (define-key map [f57] [A-f9]) + (define-key map [f58] [A-f10]) + (define-key map [f59] [A-f11]) + (define-key map [f60] [A-f12]) + + map) + "Keymap of possible alternative meanings for some keys.") + ;; List of terminals for which modify-other-keys has been turned on. (defvar xterm-modify-other-keys-terminal-list nil) =20 @@ -387,72 +462,17 @@ (string-match "\\`rxvt" (getenv "COLORTERM" (selected-frame)))) (tty-run-terminal-initialization (selected-frame) "rxvt") =20 - ;; The terminal initialization C code file might have initialized - ;; function keys F13->F60 from the termcap/terminfo information. - ;; On a PC-style keyboard these keys correspond to - ;; MODIFIER-FUNCTION_KEY, where modifier is S-, C, A-, C-S-. The code - ;; here substitutes the corresponding definitions in function-key-map. - ;; This substitution is needed because if a key definition is found in - ;; function-key-map, there are no further lookups in other keymaps. - (substitute-key-definition [f13] [S-f1] local-function-key-map) - (substitute-key-definition [f14] [S-f2] local-function-key-map) - (substitute-key-definition [f15] [S-f3] local-function-key-map) - (substitute-key-definition [f16] [S-f4] local-function-key-map) - (substitute-key-definition [f17] [S-f5] local-function-key-map) - (substitute-key-definition [f18] [S-f6] local-function-key-map) - (substitute-key-definition [f19] [S-f7] local-function-key-map) - (substitute-key-definition [f20] [S-f8] local-function-key-map) - (substitute-key-definition [f21] [S-f9] local-function-key-map) - (substitute-key-definition [f22] [S-f10] local-function-key-map) - (substitute-key-definition [f23] [S-f11] local-function-key-map) - (substitute-key-definition [f24] [S-f12] local-function-key-map) - - (substitute-key-definition [f25] [C-f1] local-function-key-map) - (substitute-key-definition [f26] [C-f2] local-function-key-map) - (substitute-key-definition [f27] [C-f3] local-function-key-map) - (substitute-key-definition [f28] [C-f4] local-function-key-map) - (substitute-key-definition [f29] [C-f5] local-function-key-map) - (substitute-key-definition [f30] [C-f6] local-function-key-map) - (substitute-key-definition [f31] [C-f7] local-function-key-map) - (substitute-key-definition [f32] [C-f8] local-function-key-map) - (substitute-key-definition [f33] [C-f9] local-function-key-map) - (substitute-key-definition [f34] [C-f10] local-function-key-map) - (substitute-key-definition [f35] [C-f11] local-function-key-map) - (substitute-key-definition [f36] [C-f12] local-function-key-map) - - (substitute-key-definition [f37] [C-S-f1] local-function-key-map) - (substitute-key-definition [f38] [C-S-f2] local-function-key-map) - (substitute-key-definition [f39] [C-S-f3] local-function-key-map) - (substitute-key-definition [f40] [C-S-f4] local-function-key-map) - (substitute-key-definition [f41] [C-S-f5] local-function-key-map) - (substitute-key-definition [f42] [C-S-f6] local-function-key-map) - (substitute-key-definition [f43] [C-S-f7] local-function-key-map) - (substitute-key-definition [f44] [C-S-f8] local-function-key-map) - (substitute-key-definition [f45] [C-S-f9] local-function-key-map) - (substitute-key-definition [f46] [C-S-f10] local-function-key-map) - (substitute-key-definition [f47] [C-S-f11] local-function-key-map) - (substitute-key-definition [f48] [C-S-f12] local-function-key-map) - - (substitute-key-definition [f49] [A-f1] local-function-key-map) - (substitute-key-definition [f50] [A-f2] local-function-key-map) - (substitute-key-definition [f51] [A-f3] local-function-key-map) - (substitute-key-definition [f52] [A-f4] local-function-key-map) - (substitute-key-definition [f53] [A-f5] local-function-key-map) - (substitute-key-definition [f54] [A-f6] local-function-key-map) - (substitute-key-definition [f55] [A-f7] local-function-key-map) - (substitute-key-definition [f56] [A-f8] local-function-key-map) - (substitute-key-definition [f57] [A-f9] local-function-key-map) - (substitute-key-definition [f58] [A-f10] local-function-key-map) - (substitute-key-definition [f59] [A-f11] local-function-key-map) - (substitute-key-definition [f60] [A-f12] local-function-key-map) + (let ((map (copy-keymap xterm-alternatives-map))) + (set-keymap-parent map (keymap-parent) local-function-key-map) + (set-keymap-parent local-function-key-map map)) =20 (let ((map (copy-keymap xterm-function-map))) =20 ;; Use inheritance to let the main keymap override those defaults. ;; This way we don't override terminfo-derived settings or settings ;; made in the .emacs file. - (set-keymap-parent map (keymap-parent local-function-key-map)) - (set-keymap-parent local-function-key-map map))) + (set-keymap-parent map (keymap-parent input-decode-map)) + (set-keymap-parent input-decode map))) =20 (xterm-register-default-colors) ;; This recomputes all the default faces given the colors we've just s= et up.