aboutsummaryrefslogtreecommitdiffstats
path: root/src/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/keymap.c')
-rw-r--r--src/keymap.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/keymap.c b/src/keymap.c
index 181dcdad3ad..e22eb411f63 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -3085,6 +3085,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
3085 for (i = from; ; i++) 3085 for (i = from; ; i++)
3086 { 3086 {
3087 bool this_shadowed = 0; 3087 bool this_shadowed = 0;
3088 Lisp_Object shadowed_by = Qnil;
3088 int range_beg, range_end; 3089 int range_beg, range_end;
3089 Lisp_Object val; 3090 Lisp_Object val;
3090 3091
@@ -3127,11 +3128,9 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
3127 /* If this binding is shadowed by some other map, ignore it. */ 3128 /* If this binding is shadowed by some other map, ignore it. */
3128 if (!NILP (shadow)) 3129 if (!NILP (shadow))
3129 { 3130 {
3130 Lisp_Object tem; 3131 shadowed_by = shadow_lookup (shadow, kludge, Qt, 0);
3131
3132 tem = shadow_lookup (shadow, kludge, Qt, 0);
3133 3132
3134 if (!NILP (tem)) 3133 if (!NILP (shadowed_by) && !EQ (shadowed_by, definition))
3135 { 3134 {
3136 if (mention_shadow) 3135 if (mention_shadow)
3137 this_shadowed = 1; 3136 this_shadowed = 1;
@@ -3186,6 +3185,21 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
3186 && !NILP (Fequal (tem2, definition))) 3185 && !NILP (Fequal (tem2, definition)))
3187 i++; 3186 i++;
3188 3187
3188 /* Make sure found consecutive keys are either not shadowed or,
3189 if they are, that they are shadowed by the same command. */
3190 if (CHAR_TABLE_P (vector) && i != starting_i)
3191 {
3192 Lisp_Object tem;
3193 Lisp_Object key = make_nil_vector (1);
3194 for (int j = starting_i + 1; j <= i; j++)
3195 {
3196 ASET (key, 0, make_fixnum (j));
3197 tem = shadow_lookup (shadow, key, Qt, 0);
3198 if (NILP (Fequal (tem, shadowed_by)))
3199 i = j - 1;
3200 }
3201 }
3202
3189 /* If we have a range of more than one character, 3203 /* If we have a range of more than one character,
3190 print where the range reaches to. */ 3204 print where the range reaches to. */
3191 3205
@@ -3209,7 +3223,13 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
3209 if (this_shadowed) 3223 if (this_shadowed)
3210 { 3224 {
3211 SET_PT (PT - 1); 3225 SET_PT (PT - 1);
3212 insert_string (" (binding currently shadowed)"); 3226 static char const fmt[] = " (currently shadowed by `%s')";
3227 USE_SAFE_ALLOCA;
3228 char *buffer = SAFE_ALLOCA (sizeof fmt +
3229 SBYTES (SYMBOL_NAME (shadowed_by)));
3230 esprintf (buffer, fmt, SDATA (SYMBOL_NAME (shadowed_by)));
3231 insert_string (buffer);
3232 SAFE_FREE();
3213 SET_PT (PT + 1); 3233 SET_PT (PT + 1);
3214 } 3234 }
3215 } 3235 }