]> code.delx.au - gnu-emacs/blobdiff - src/keymap.c
(x_set_name_internal): Set icon to `text', derived from name, when
[gnu-emacs] / src / keymap.c
index d25bf150b8811fb987ea5a7bd32c4598de48edcb..ecc2f7b2944fc8ac92a80e25e56137a071371c17 100644 (file)
@@ -699,6 +699,7 @@ map_keymap (map, fun, args, data, autoload)
   struct gcpro gcpro1, gcpro2, gcpro3;
   Lisp_Object tail;
 
+  tail = Qnil;
   GCPRO3 (map, args, tail);
   map = get_keymap (map, 1, autoload);
   for (tail = (CONSP (map) && EQ (Qkeymap, XCAR (map))) ? XCDR (map) : map;
@@ -865,7 +866,7 @@ static Lisp_Object
 store_in_keymap (keymap, idx, def)
      Lisp_Object keymap;
      register Lisp_Object idx;
-     register Lisp_Object def;
+     Lisp_Object def;
 {
   /* Flush any reverse-map cache.  */
   where_is_cache = Qnil;
@@ -1192,8 +1193,11 @@ binding KEY to DEF is added at the front of KEYMAP.  */)
       if (!CONSP (keymap))
        /* We must use Fkey_description rather than just passing key to
           error; key might be a vector, not a string.  */
-       error ("Key sequence %s uses invalid prefix characters",
-              SDATA (Fkey_description (key, Qnil)));
+       error ("Key sequence %s starts with non-prefix key %s",
+              SDATA (Fkey_description (key, Qnil)),
+              SDATA (Fkey_description (Fsubstring (key, make_number (0),
+                                                   make_number (idx)),
+                                       Qnil)));
     }
 }
 
@@ -2086,12 +2090,21 @@ push_key_description (c, p, force_multibyte)
      int force_multibyte;
 {
   unsigned c2;
+  int valid_p;
 
   /* Clear all the meaningless bits above the meta bit.  */
   c &= meta_modifier | ~ - meta_modifier;
   c2 = c & ~(alt_modifier | ctrl_modifier | hyper_modifier
             | meta_modifier | shift_modifier | super_modifier);
 
+  valid_p = SINGLE_BYTE_CHAR_P (c2) || char_valid_p (c2, 0);
+  if (! valid_p)
+    {
+      /* KEY_DESCRIPTION_SIZE is large enough for this.  */
+      p += sprintf (p, "[%d]", c);
+      return p;
+    }
+
   if (c & alt_modifier)
     {
       *p++ = 'A';
@@ -2179,16 +2192,13 @@ push_key_description (c, p, force_multibyte)
     }
   else
     {
-      int valid_p = SINGLE_BYTE_CHAR_P (c) || char_valid_p (c, 0);
-
-      if (force_multibyte && valid_p)
+      if (force_multibyte)
        {
          if (SINGLE_BYTE_CHAR_P (c))
            c = unibyte_char_to_multibyte (c);
          p += CHAR_STRING (c, p);
        }
-      else if (NILP (current_buffer->enable_multibyte_characters)
-              || valid_p)
+      else if (NILP (current_buffer->enable_multibyte_characters))
        {
          int bit_offset;
          *p++ = '\\';
@@ -3287,7 +3297,9 @@ describe_map (map, prefix, elt_describer, partial, shadow,
              tem = shadow_lookup (shadow, kludge, Qt);
              if (!NILP (tem))
                {
-                 if (mention_shadow)
+                 /* Avoid generating duplicate entries if the
+                    shadowed binding has the same definition. */
+                 if (mention_shadow && !EQ (tem, definition))
                    this_shadowed = 1;
                  else
                    continue;
@@ -3342,7 +3354,7 @@ describe_map (map, prefix, elt_describer, partial, shadow,
       if (INTEGERP (vect[i].event))
        {
          while (i + 1 < slots_used
-                && XINT (vect[i + 1].event) == XINT (vect[i].event) + 1
+                && EQ (vect[i+1].event, make_number (XINT (vect[i].event) + 1))
                 && !NILP (Fequal (vect[i + 1].definition, definition))
                 && vect[i].shadowed == vect[i + 1].shadowed)
            i++;
@@ -3371,7 +3383,7 @@ describe_map (map, prefix, elt_describer, partial, shadow,
       if (vect[i].shadowed)
        {
          SET_PT (PT - 1);
-         insert_string ("  (shadowed)");
+         insert_string ("\n  (that binding is currently shadowed by another mode)");
          SET_PT (PT + 1);
        }
     }