]> git.eshelyaron.com Git - emacs.git/commitdiff
(access_keymap): If IDX has a meta prefix, and there's
authorGerd Moellmann <gerd@gnu.org>
Wed, 18 Oct 2000 14:20:53 +0000 (14:20 +0000)
committerGerd Moellmann <gerd@gnu.org>
Wed, 18 Oct 2000 14:20:53 +0000 (14:20 +0000)
no map for meta_prefix_char, don't try to use it as a keymap.
Instead, if T_OK is non-zero, look up a default binding, if any,
otherwise, if T_OK is zero, return nil.

src/keymap.c

index fbbbcae3998e34ab77c4424c70f50fcb2495c4c2..72d40d09872722b4f11f28d911090b1df7e56b3d 100644 (file)
@@ -483,10 +483,23 @@ access_keymap (map, idx, t_ok, noinherit, autoload)
   /* Handle the special meta -> esc mapping. */
   if (INTEGERP (idx) && XUINT (idx) & meta_modifier)
     {
-      map = get_keymap_1 (access_keymap
-                         (map, meta_prefix_char, t_ok, noinherit, autoload),
-                         0, autoload);
-      XSETINT (idx, XFASTINT (idx) & ~meta_modifier);
+      Lisp_Object meta_map;
+
+      /* See if there is a meta-map.  If there's none, there is
+         no binding for IDX, unless a default binding exists in MAP.  */
+      meta_map = access_keymap (map, meta_prefix_char, t_ok, noinherit,
+                               autoload);
+      if (KEYMAPP (meta_map))
+       {
+         map = get_keymap_1 (meta_map, 0, autoload);
+         idx = make_number (XUINT (idx) & ~meta_modifier);
+       }
+      else if (t_ok)
+       /* Set IDX to t, so that we only find a default binding.  */
+       idx = Qt;
+      else
+       /* We know there is no binding.  */
+       return Qnil;
     }
 
   {
@@ -495,7 +508,9 @@ access_keymap (map, idx, t_ok, noinherit, autoload)
 
     t_binding = Qnil;
     for (tail = XCDR (map);
-        CONSP (tail) || (tail = get_keymap_1(tail, 0, autoload), CONSP (tail));
+        (CONSP (tail)
+         || (tail = get_keymap_1 (tail, 0, autoload),
+             CONSP (tail)));
         tail = XCDR (tail))
       {
        Lisp_Object binding;