emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New input translation map


From: Stefan Monnier
Subject: New input translation map
Date: Wed, 03 Oct 2007 17:44:03 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux)

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û 2007 22:33:12 -0400      1.78
+++ keyboard.h  03 oct 2007 17:30:59 -0400      
@@ -127,13 +127,14 @@
     /* Cache for modify_event_symbol.  */
     Lisp_Object system_key_syms;
 
-    /* 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;
     
-    /* 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;
 
     /* 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;
 
-/* Parent keymap of terminal-local key-translation-map instances.  */
+/* Keymap of key translations that can override keymaps.  */
 extern Lisp_Object Vkey_translation_map;
 
 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      
@@ -445,7 +445,7 @@
 /* Parent keymap of terminal-local function-key-map instances.  */
 Lisp_Object Vfunction_key_map;
 
-/* Parent keymap of terminal-local key-translation-map instances.  */
+/* Keymap of key translations that can override keymaps.  */
 Lisp_Object Vkey_translation_map;
 
 /* 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;
 
-  /* Likewise, for key_translation_map.  */
-  volatile keyremap keytran;
+  /* Likewise, for key_translation_map and input-decode-map.  */
+  volatile keyremap keytran, indec;
 
   /* 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 @@
 
   /* We may switch keyboards between rescans, so we need to
      reinitialize fkey and keytran before each replay.  */
+  indec.map = indec.parent = current_kboard->Vinput_decode_map;
   fkey.map = fkey.parent = current_kboard->Vlocal_function_key_map;
-  keytran.map = keytran.parent = current_kboard->Vlocal_key_translation_map;
+  keytran.map = keytran.parent = Vkey_translation_map;
+  indec.start = indec.end = 0;
   fkey.start = fkey.end = 0;
   keytran.start = keytran.end = 0;
 
@@ -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 = 0;
@@ -9317,13 +9319,17 @@
         just one key.  */
       volatile int echo_local_start, keys_local_start, local_first_binding;
 
-      eassert (fkey.end == t || (fkey.end > t && fkey.end <= mock_input));
+      eassert (indec.end == t || (indec.end > t && indec.end <= mock_input));
+      eassert (indec.start <= indec.end);
       eassert (fkey.start <= fkey.end);
       eassert (keytran.start <= 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 <= indec.start);
       eassert (keytran.end <= fkey.start);
 
-      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 = first_unbound + 1; i < t; i++)
            keybuf[i - first_unbound - 1] = keybuf[i];
          mock_input = t - first_unbound - 1;
+         indec.end = indec.start -= first_unbound + 1;
+         indec.map = indec.parent;
          fkey.end = fkey.start -= first_unbound + 1;
          fkey.map = fkey.parent;
          keytran.end = keytran.start -= 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 = max (t + 1, first_unbound);
       else
        {
          Lisp_Object head;
 
-         /* Remember the position to put an upper bound on fkey.start.  */
+         /* Remember the position to put an upper bound on indec.start.  */
          first_unbound = min (t, first_unbound);
 
          head = 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 <= t + 1, we need to adjust fkey
-                            and keytran.
+                            if mock_input <= t + 1, we need to adjust indec,
+                            fkey, and keytran.
                             Typical case [header-line down-mouse-N]:
                             mock_input = 2, t = 1, fkey.end = 1,
                             last_real_key_start = 0.  */
+                         if (indec.end > last_real_key_start)
+                           {
+                             indec.end = indec.start
+                               = min (last_real_key_start, indec.start);
+                             indec.map = indec.parent;
                          if (fkey.end > last_real_key_start)
                            {
                              fkey.end = fkey.start
@@ -9868,6 +9881,7 @@
                                  keytran.map = keytran.parent;
                                }
                            }
+                           }
                          if (t == last_real_key_start)
                            {
                              mock_input = 0;
@@ -9919,8 +9933,28 @@
       /* Record what part of this_command_keys is the current key sequence.  */
       this_single_command_key_start = this_command_key_count - t;
 
-      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 = keyremap_step (keybuf, bufsize, &indec, max (t, mock_input),
+                               1, &diff, prompt);
+         UNGCPRO;
+         if (done)
+           {
+             mock_input = diff + max (t, mock_input);
+             goto replay_sequence;
+           }
+       }
+
+      if (first_binding < nmaps && NILP (submaps[first_binding])
+         && indec.start >= 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;
 
-           GCPRO3 (fkey.map, keytran.map, delayed_switch_frame);
+           GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame);
            done = keyremap_step (keybuf, bufsize, &fkey,
                                  max (t, mock_input),
                                  /* If there's a binding (i.e.
@@ -9950,6 +9984,10 @@
            if (done)
              {
                mock_input = diff + max (t, mock_input);
+               /* Adjust the input-decode-map counters.  */
+               indec.end += diff;
+               indec.start += 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;
 
-         GCPRO3 (fkey.map, keytran.map, delayed_switch_frame);
+         GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame);
          done = keyremap_step (keybuf, bufsize, &keytran, max (t, mock_input),
                                1, &diff, prompt);
          UNGCPRO;
          if (done)
            {
              mock_input = diff + max (t, mock_input);
-             /* Adjust the function-key-map counters.  */
+             /* Adjust the function-key-map and input-decode-map counters.  */
+             indec.end += diff;
+             indec.start += diff;
              fkey.end += diff;
              fkey.start += diff;
 
@@ -9981,7 +10021,7 @@
         and is an upper case letter
         use the corresponding lower-case letter instead.  */
       if (first_binding >= nmaps
-         && fkey.start >= t && keytran.start >= t
+         && /* indec.start >= t && fkey.start >= t && */ keytran.start >= 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 >= nmaps
-         && fkey.start >= t && keytran.start >= t
+         && /* indec.start >= t && fkey.start >= t && */ keytran.start >= t
          && SYMBOLP (key))
        {
          Lisp_Object breakdown;
@@ -10033,9 +10073,6 @@
 
              keybuf[t - 1] = new_key;
              mock_input = max (t, mock_input);
-             fkey.start = fkey.end = 0;
-             keytran.start = keytran.end = 0;
-
              goto replay_sequence;
            }
        }
@@ -11460,10 +11497,9 @@
   kb->reference_count = 0;
   kb->Vsystem_key_alist = Qnil;
   kb->system_key_syms = Qnil;
+  kb->Vinput_decode_map = Fmake_sparse_keymap (Qnil);
   kb->Vlocal_function_key_map = Fmake_sparse_keymap (Qnil);
   Fset_keymap_parent (kb->Vlocal_function_key_map, Vfunction_key_map);
-  kb->Vlocal_key_translation_map = Fmake_sparse_keymap (Qnil);
-  Fset_keymap_parent (kb->Vlocal_key_translation_map, Vkey_translation_map);
   kb->Vdefault_minibuffer_frame = Qnil;
 }
 
@@ -12196,8 +12232,8 @@
 
   DEFVAR_KBOARD ("local-function-key-map", Vlocal_function_key_map,
                  doc: /* Keymap that translates key sequences to key sequences 
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).
 
 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.  */);
 
+  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' 
instances.
 Function key definitions that apply to all terminal devices should go
@@ -12231,18 +12286,11 @@
 definition will take precendence.  */);
   Vfunction_key_map = Fmake_sparse_keymap (Qnil);
                     
-  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 = Fmake_sparse_keymap (Qnil);
 
   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û 2007 22:33:12 -0400      1.361
+++ keymap.c    03 oct 2007 06:56:58 -0400      
@@ -3027,8 +3027,8 @@
       insert ("\n", 1);
     }
 
-  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);
 
 
@@ -3121,6 +3121,11 @@
     describe_map_tree (current_kboard->Vlocal_function_key_map, 0, Qnil, 
prefix,
                       "\f\nFunction key map translations", nomenu, 1, 0, 0);
 
+  /* 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      
@@ -1274,9 +1274,9 @@
 static KBOARD *term_get_fkeys_kboard;
 static Lisp_Object term_get_fkeys_1 ();
 
-/* 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.  */
 
 static void
 term_get_fkeys (address, kboard)
@@ -1306,14 +1306,14 @@
   KBOARD *kboard = term_get_fkeys_kboard;
   
   /* This can happen if CANNOT_DUMP or with strange options.  */
-  if (!initialized)
-    kboard->Vlocal_function_key_map = Fmake_sparse_keymap (Qnil);
+  if (!KEYMAPP (kboard->Vinput_decode_map))
+    kboard->Vinput_decode_map = Fmake_sparse_keymap (Qnil);
 
   for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++)
     {
       char *sequence = 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)));
   }
 
@@ -1362,7 +1362,7 @@
          if (sequence)
            {
              sprintf (fkey, "f%d", i);
-             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 (fkey)));
            }
@@ -1379,7 +1379,7 @@
        {                                                               \
          char *sequence = 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      
@@ -375,6 +375,72 @@
     map)
   "Function key map overrides for xterm.")
 
+(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)
 
@@ -387,72 +462,17 @@
           (string-match "\\`rxvt" (getenv "COLORTERM" (selected-frame))))
       (tty-run-terminal-initialization (selected-frame) "rxvt")
 
-    ;; 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))
 
     (let ((map (copy-keymap xterm-function-map)))
 
       ;; 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)))
 
     (xterm-register-default-colors)
     ;; This recomputes all the default faces given the colors we've just set 
up.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]