aboutsummaryrefslogtreecommitdiffstats
path: root/src/keymap.c
diff options
context:
space:
mode:
authorKenichi Handa2003-09-08 12:53:41 +0000
committerKenichi Handa2003-09-08 12:53:41 +0000
commit8f924df7df019cce90537647de2627581043b5c4 (patch)
tree6c40bd05679425e710d6b2e5649eae3da5e40a52 /src/keymap.c
parent463f5630a5e7cbe7f042bc1175d1fa1c4e98860f (diff)
parent9d4807432a01f9b3cc519fcfa3ea92a70ffa7f43 (diff)
downloademacs-8f924df7df019cce90537647de2627581043b5c4.tar.gz
emacs-8f924df7df019cce90537647de2627581043b5c4.zip
*** empty log message ***
Diffstat (limited to 'src/keymap.c')
-rw-r--r--src/keymap.c363
1 files changed, 80 insertions, 283 deletions
diff --git a/src/keymap.c b/src/keymap.c
index 64f849f7845..c274183de49 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -25,6 +25,7 @@ Boston, MA 02111-1307, USA. */
25#include "lisp.h" 25#include "lisp.h"
26#include "commands.h" 26#include "commands.h"
27#include "buffer.h" 27#include "buffer.h"
28#include "character.h"
28#include "charset.h" 29#include "charset.h"
29#include "keyboard.h" 30#include "keyboard.h"
30#include "termhooks.h" 31#include "termhooks.h"
@@ -413,8 +414,7 @@ PARENT should be nil or another keymap. */)
413 Lisp_Object indices[3]; 414 Lisp_Object indices[3];
414 415
415 map_char_table (fix_submap_inheritance, Qnil, 416 map_char_table (fix_submap_inheritance, Qnil,
416 XCAR (list), XCAR (list), 417 XCAR (list), keymap);
417 keymap, 0, indices);
418 } 418 }
419 } 419 }
420 420
@@ -550,9 +550,7 @@ access_keymap (map, idx, t_ok, noinherit, autoload)
550 550
551 GCPRO4 (map, tail, idx, t_binding); 551 GCPRO4 (map, tail, idx, t_binding);
552 552
553 /* If `t_ok' is 2, both `t' and generic-char bindings are accepted. 553 /* If `t_ok' is 2, both `t' is accepted. */
554 If it is 1, only generic-char bindings are accepted.
555 Otherwise, neither are. */
556 t_ok = t_ok ? 2 : 0; 554 t_ok = t_ok ? 2 : 0;
557 555
558 for (tail = XCDR (map); 556 for (tail = XCDR (map);
@@ -576,24 +574,6 @@ access_keymap (map, idx, t_ok, noinherit, autoload)
576 574
577 if (EQ (key, idx)) 575 if (EQ (key, idx))
578 val = XCDR (binding); 576 val = XCDR (binding);
579 else if (t_ok
580 && INTEGERP (idx)
581 && (XINT (idx) & CHAR_MODIFIER_MASK) == 0
582 && INTEGERP (key)
583 && (XINT (key) & CHAR_MODIFIER_MASK) == 0
584 && !SINGLE_BYTE_CHAR_P (XINT (idx))
585 && !SINGLE_BYTE_CHAR_P (XINT (key))
586 && CHAR_VALID_P (XINT (key), 1)
587 && !CHAR_VALID_P (XINT (key), 0)
588 && (CHAR_CHARSET (XINT (key))
589 == CHAR_CHARSET (XINT (idx))))
590 {
591 /* KEY is the generic character of the charset of IDX.
592 Use KEY's binding if there isn't a binding for IDX
593 itself. */
594 t_binding = XCDR (binding);
595 t_ok = 0;
596 }
597 else if (t_ok > 1 && EQ (key, Qt)) 577 else if (t_ok > 1 && EQ (key, Qt))
598 { 578 {
599 t_binding = XCDR (binding); 579 t_binding = XCDR (binding);
@@ -687,7 +667,7 @@ map_keymap (map, fun, args, data, autoload)
687 tail = XCDR (tail)) 667 tail = XCDR (tail))
688 { 668 {
689 Lisp_Object binding = XCAR (tail); 669 Lisp_Object binding = XCAR (tail);
690 670
691 if (CONSP (binding)) 671 if (CONSP (binding))
692 map_keymap_item (fun, args, XCAR (binding), XCDR (binding), data); 672 map_keymap_item (fun, args, XCAR (binding), XCDR (binding), data);
693 else if (VECTORP (binding)) 673 else if (VECTORP (binding))
@@ -706,11 +686,10 @@ map_keymap (map, fun, args, data, autoload)
706 else if (CHAR_TABLE_P (binding)) 686 else if (CHAR_TABLE_P (binding))
707 { 687 {
708 Lisp_Object indices[3]; 688 Lisp_Object indices[3];
709 map_char_table (map_keymap_char_table_item, Qnil, binding, binding, 689 map_char_table (map_keymap_char_table_item, Qnil, binding,
710 Fcons (make_save_value (fun, 0), 690 Fcons (make_save_value (fun, 0),
711 Fcons (make_save_value (data, 0), 691 Fcons (make_save_value (data, 0),
712 args)), 692 args)));
713 0, indices);
714 } 693 }
715 } 694 }
716 UNGCPRO; 695 UNGCPRO;
@@ -906,6 +885,11 @@ store_in_keymap (keymap, idx, def)
906 NILP (def) ? Qt : def); 885 NILP (def) ? Qt : def);
907 return def; 886 return def;
908 } 887 }
888 else if (CONSP (idx) && CHARACTERP (XCAR (idx)))
889 {
890 Fset_char_table_range (elt, idx, NILP (def) ? Qt : def);
891 return def;
892 }
909 insertion_point = tail; 893 insertion_point = tail;
910 } 894 }
911 else if (CONSP (elt)) 895 else if (CONSP (elt))
@@ -1016,7 +1000,7 @@ static void
1016copy_keymap_1 (chartable, idx, elt) 1000copy_keymap_1 (chartable, idx, elt)
1017 Lisp_Object chartable, idx, elt; 1001 Lisp_Object chartable, idx, elt;
1018{ 1002{
1019 Faset (chartable, idx, copy_keymap_item (elt)); 1003 Fset_char_table_range (chartable, idx, copy_keymap_item (elt));
1020} 1004}
1021 1005
1022DEFUN ("copy-keymap", Fcopy_keymap, Scopy_keymap, 1, 1, 0, 1006DEFUN ("copy-keymap", Fcopy_keymap, Scopy_keymap, 1, 1, 0,
@@ -1041,7 +1025,7 @@ is not copied. */)
1041 { 1025 {
1042 Lisp_Object indices[3]; 1026 Lisp_Object indices[3];
1043 elt = Fcopy_sequence (elt); 1027 elt = Fcopy_sequence (elt);
1044 map_char_table (copy_keymap_1, Qnil, elt, elt, elt, 0, indices); 1028 map_char_table (copy_keymap_1, Qnil, elt, elt);
1045 } 1029 }
1046 else if (VECTORP (elt)) 1030 else if (VECTORP (elt))
1047 { 1031 {
@@ -1122,8 +1106,15 @@ binding KEY to DEF is added at the front of KEYMAP. */)
1122 { 1106 {
1123 c = Faref (key, make_number (idx)); 1107 c = Faref (key, make_number (idx));
1124 1108
1125 if (CONSP (c) && lucid_event_type_list_p (c)) 1109 if (CONSP (c))
1126 c = Fevent_convert_list (c); 1110 {
1111 /* C may be a cons (FROM . TO) specifying a range of
1112 characters. */
1113 if (CHARACTERP (XCAR (c)))
1114 CHECK_CHARACTER_CDR (c);
1115 else if (lucid_event_type_list_p (c))
1116 c = Fevent_convert_list (c);
1117 }
1127 1118
1128 if (SYMBOLP (c)) 1119 if (SYMBOLP (c))
1129 silly_event_symbol_error (c); 1120 silly_event_symbol_error (c);
@@ -1144,7 +1135,10 @@ binding KEY to DEF is added at the front of KEYMAP. */)
1144 idx++; 1135 idx++;
1145 } 1136 }
1146 1137
1147 if (!INTEGERP (c) && !SYMBOLP (c) && !CONSP (c)) 1138 if (!INTEGERP (c) && !SYMBOLP (c)
1139 && (!CONSP (c)
1140 /* If C is a range, it must be a leaf. */
1141 || (INTEGERP (XCAR (c)) && idx != length)))
1148 error ("Key sequence contains invalid event"); 1142 error ("Key sequence contains invalid event");
1149 1143
1150 if (idx == length) 1144 if (idx == length)
@@ -1792,9 +1786,9 @@ accessible_keymaps_1 (key, cmd, maps, tail, thisseq, is_metized)
1792 int meta_bit = meta_modifier; 1786 int meta_bit = meta_modifier;
1793 Lisp_Object last = make_number (XINT (Flength (thisseq)) - 1); 1787 Lisp_Object last = make_number (XINT (Flength (thisseq)) - 1);
1794 tem = Fcopy_sequence (thisseq); 1788 tem = Fcopy_sequence (thisseq);
1795 1789
1796 Faset (tem, last, make_number (XINT (key) | meta_bit)); 1790 Faset (tem, last, make_number (XINT (key) | meta_bit));
1797 1791
1798 /* This new sequence is the same length as 1792 /* This new sequence is the same length as
1799 thisseq, so stick it in the list right 1793 thisseq, so stick it in the list right
1800 after this one. */ 1794 after this one. */
@@ -1915,10 +1909,9 @@ then the value includes only maps for prefixes that start with PREFIX. */)
1915 { 1909 {
1916 Lisp_Object indices[3]; 1910 Lisp_Object indices[3];
1917 1911
1918 map_char_table (accessible_keymaps_char_table, Qnil, elt, 1912 map_char_table (accessible_keymaps_char_table, Qnil,
1919 elt, Fcons (Fcons (maps, make_number (is_metized)), 1913 elt, Fcons (Fcons (maps, make_number (is_metized)),
1920 Fcons (tail, thisseq)), 1914 Fcons (tail, thisseq)));
1921 0, indices);
1922 } 1915 }
1923 else if (VECTORP (elt)) 1916 else if (VECTORP (elt))
1924 { 1917 {
@@ -2115,30 +2108,24 @@ push_key_description (c, p, force_multibyte)
2115 { 2108 {
2116 *p++ = c; 2109 *p++ = c;
2117 } 2110 }
2111 else if (CHARACTERP (make_number (c)))
2112 {
2113 if (NILP (current_buffer->enable_multibyte_characters)
2114 && ! force_multibyte)
2115 *p++ = multibyte_char_to_unibyte (c, Qnil);
2116 else
2117 p += CHAR_STRING (c, (unsigned char *) p);
2118 }
2118 else 2119 else
2119 { 2120 {
2120 int valid_p = SINGLE_BYTE_CHAR_P (c) || char_valid_p (c, 0); 2121 int bit_offset;
2121 2122 *p++ = '\\';
2122 if (force_multibyte && valid_p) 2123 /* The biggest character code uses 22 bits. */
2124 for (bit_offset = 21; bit_offset >= 0; bit_offset -= 3)
2123 { 2125 {
2124 if (SINGLE_BYTE_CHAR_P (c)) 2126 if (c >= (1 << bit_offset))
2125 c = unibyte_char_to_multibyte (c); 2127 *p++ = ((c & (7 << bit_offset)) >> bit_offset) + '0';
2126 p += CHAR_STRING (c, p);
2127 }
2128 else if (NILP (current_buffer->enable_multibyte_characters)
2129 || valid_p)
2130 {
2131 int bit_offset;
2132 *p++ = '\\';
2133 /* The biggest character code uses 19 bits. */
2134 for (bit_offset = 18; bit_offset >= 0; bit_offset -= 3)
2135 {
2136 if (c >= (1 << bit_offset))
2137 *p++ = ((c & (7 << bit_offset)) >> bit_offset) + '0';
2138 }
2139 } 2128 }
2140 else
2141 p += CHAR_STRING (c, p);
2142 } 2129 }
2143 2130
2144 return p; 2131 return p;
@@ -2162,43 +2149,10 @@ around function keys and event symbols. */)
2162 2149
2163 if (INTEGERP (key)) /* Normal character */ 2150 if (INTEGERP (key)) /* Normal character */
2164 { 2151 {
2165 unsigned int charset, c1, c2; 2152 char tem[KEY_DESCRIPTION_SIZE];
2166 int without_bits = XINT (key) & ~((-1) << CHARACTERBITS);
2167
2168 if (SINGLE_BYTE_CHAR_P (without_bits))
2169 charset = 0;
2170 else
2171 SPLIT_CHAR (without_bits, charset, c1, c2);
2172 2153
2173 if (charset 2154 *push_key_description (XUINT (key), tem, 1) = 0;
2174 && CHARSET_DEFINED_P (charset) 2155 return build_string (tem);
2175 && ((c1 >= 0 && c1 < 32)
2176 || (c2 >= 0 && c2 < 32)))
2177 {
2178 /* Handle a generic character. */
2179 Lisp_Object name;
2180 name = CHARSET_TABLE_INFO (charset, CHARSET_LONG_NAME_IDX);
2181 CHECK_STRING (name);
2182 return concat2 (build_string ("Character set "), name);
2183 }
2184 else
2185 {
2186 char tem[KEY_DESCRIPTION_SIZE], *end;
2187 int nbytes, nchars;
2188 Lisp_Object string;
2189
2190 end = push_key_description (XUINT (key), tem, 1);
2191 nbytes = end - tem;
2192 nchars = multibyte_chars_in_text (tem, nbytes);
2193 if (nchars == nbytes)
2194 {
2195 *end = '\0';
2196 string = build_string (tem);
2197 }
2198 else
2199 string = make_multibyte_string (tem, nchars, nbytes);
2200 return string;
2201 }
2202 } 2156 }
2203 else if (SYMBOLP (key)) /* Function key or event-symbol */ 2157 else if (SYMBOLP (key)) /* Function key or event-symbol */
2204 { 2158 {
@@ -2260,7 +2214,7 @@ Control characters turn into "^char", etc. */)
2260 CHECK_NUMBER (character); 2214 CHECK_NUMBER (character);
2261 2215
2262 c = XINT (character); 2216 c = XINT (character);
2263 if (!SINGLE_BYTE_CHAR_P (c)) 2217 if (!ASCII_CHAR_P (c))
2264 { 2218 {
2265 int len = CHAR_STRING (c, str); 2219 int len = CHAR_STRING (c, str);
2266 2220
@@ -2432,8 +2386,7 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap)
2432 Fcons (Fcons (this, last), 2386 Fcons (Fcons (this, last),
2433 Fcons (make_number (nomenus), 2387 Fcons (make_number (nomenus),
2434 make_number (last_is_meta)))); 2388 make_number (last_is_meta))));
2435 map_char_table (where_is_internal_2, Qnil, elt, elt, args, 2389 map_char_table (where_is_internal_2, Qnil, elt, args);
2436 0, indices);
2437 sequences = XCDR (XCAR (args)); 2390 sequences = XCDR (XCAR (args));
2438 } 2391 }
2439 else if (CONSP (elt)) 2392 else if (CONSP (elt))
@@ -3246,11 +3199,10 @@ This is text showing the elements of vector matched against indices. */)
3246 If the definition in effect in the whole map does not match 3199 If the definition in effect in the whole map does not match
3247 the one in this vector, we ignore this one. 3200 the one in this vector, we ignore this one.
3248 3201
3249 When describing a sub-char-table, INDICES is a list of 3202 ARGS is simply passed as the second argument to ELT_DESCRIBER.
3250 indices at higher levels in this char-table,
3251 and CHAR_TABLE_DEPTH says how many levels down we have gone.
3252 3203
3253 ARGS is simply passed as the second argument to ELT_DESCRIBER. */ 3204 INDICES and CHAR_TABLE_DEPTH are ignored. They will be removed in
3205 the near future. */
3254 3206
3255void 3207void
3256describe_vector (vector, elt_prefix, args, elt_describer, 3208describe_vector (vector, elt_prefix, args, elt_describer,
@@ -3267,24 +3219,18 @@ describe_vector (vector, elt_prefix, args, elt_describer,
3267{ 3219{
3268 Lisp_Object definition; 3220 Lisp_Object definition;
3269 Lisp_Object tem2; 3221 Lisp_Object tem2;
3270 register int i; 3222 int i;
3271 Lisp_Object suppress; 3223 Lisp_Object suppress;
3272 Lisp_Object kludge; 3224 Lisp_Object kludge;
3273 int first = 1;
3274 struct gcpro gcpro1, gcpro2, gcpro3; 3225 struct gcpro gcpro1, gcpro2, gcpro3;
3275 /* Range of elements to be handled. */ 3226 /* Range of elements to be handled. */
3276 int from, to; 3227 int from, to;
3277 /* A flag to tell if a leaf in this level of char-table is not a 3228 Lisp_Object character;
3278 generic character (i.e. a complete multibyte character). */
3279 int complete_char;
3280 int character;
3281 int starting_i; 3229 int starting_i;
3230 int first = 1;
3282 3231
3283 suppress = Qnil; 3232 suppress = Qnil;
3284 3233
3285 if (indices == 0)
3286 indices = (int *) alloca (3 * sizeof (int));
3287
3288 definition = Qnil; 3234 definition = Qnil;
3289 3235
3290 /* This vector gets used to present single keys to Flookup_key. Since 3236 /* This vector gets used to present single keys to Flookup_key. Since
@@ -3296,60 +3242,23 @@ describe_vector (vector, elt_prefix, args, elt_describer,
3296 if (partial) 3242 if (partial)
3297 suppress = intern ("suppress-keymap"); 3243 suppress = intern ("suppress-keymap");
3298 3244
3299 if (CHAR_TABLE_P (vector)) 3245 from = 0;
3300 { 3246 to = CHAR_TABLE_P (vector) ? MAX_CHAR + 1 : XVECTOR (vector)->size;
3301 if (char_table_depth == 0)
3302 {
3303 /* VECTOR is a top level char-table. */
3304 complete_char = 1;
3305 from = 0;
3306 to = CHAR_TABLE_ORDINARY_SLOTS;
3307 }
3308 else
3309 {
3310 /* VECTOR is a sub char-table. */
3311 if (char_table_depth >= 3)
3312 /* A char-table is never that deep. */
3313 error ("Too deep char table");
3314
3315 complete_char
3316 = (CHARSET_VALID_P (indices[0])
3317 && ((CHARSET_DIMENSION (indices[0]) == 1
3318 && char_table_depth == 1)
3319 || char_table_depth == 2));
3320
3321 /* Meaningful elements are from 32th to 127th. */
3322 from = 32;
3323 to = SUB_CHAR_TABLE_ORDINARY_SLOTS;
3324 }
3325 }
3326 else
3327 {
3328 /* This does the right thing for ordinary vectors. */
3329
3330 complete_char = 1;
3331 from = 0;
3332 to = XVECTOR (vector)->size;
3333 }
3334 3247
3335 for (i = from; i < to; i++) 3248 for (i = from; i < to; i++)
3336 { 3249 {
3337 QUIT; 3250 int range_beg, range_end;
3251 Lisp_Object val;
3338 3252
3339 if (CHAR_TABLE_P (vector)) 3253 QUIT;
3340 {
3341 if (char_table_depth == 0 && i >= CHAR_TABLE_SINGLE_BYTE_SLOTS)
3342 complete_char = 0;
3343 3254
3344 if (i >= CHAR_TABLE_SINGLE_BYTE_SLOTS 3255 starting_i = i;
3345 && !CHARSET_DEFINED_P (i - 128))
3346 continue;
3347 3256
3348 definition 3257 if (CHAR_TABLE_P (vector))
3349 = get_keyelt (XCHAR_TABLE (vector)->contents[i], 0); 3258 val = char_table_ref_and_range (vector, i, &range_beg, &i);
3350 }
3351 else 3259 else
3352 definition = get_keyelt (AREF (vector, i), 0); 3260 val = AREF (vector, i);
3261 definition = get_keyelt (val, 0);
3353 3262
3354 if (NILP (definition)) continue; 3263 if (NILP (definition)) continue;
3355 3264
@@ -3363,33 +3272,14 @@ describe_vector (vector, elt_prefix, args, elt_describer,
3363 if (!NILP (tem)) continue; 3272 if (!NILP (tem)) continue;
3364 } 3273 }
3365 3274
3366 /* Set CHARACTER to the character this entry describes, if any. 3275 character = make_number (starting_i);
3367 Also update *INDICES. */
3368 if (CHAR_TABLE_P (vector))
3369 {
3370 indices[char_table_depth] = i;
3371
3372 if (char_table_depth == 0)
3373 {
3374 character = i;
3375 indices[0] = i - 128;
3376 }
3377 else if (complete_char)
3378 {
3379 character = MAKE_CHAR (indices[0], indices[1], indices[2]);
3380 }
3381 else
3382 character = 0;
3383 }
3384 else
3385 character = i;
3386 3276
3387 /* If this binding is shadowed by some other map, ignore it. */ 3277 /* If this binding is shadowed by some other map, ignore it. */
3388 if (!NILP (shadow) && complete_char) 3278 if (!NILP (shadow))
3389 { 3279 {
3390 Lisp_Object tem; 3280 Lisp_Object tem;
3391 3281
3392 ASET (kludge, 0, make_number (character)); 3282 ASET (kludge, 0, character);
3393 tem = shadow_lookup (shadow, kludge, Qt); 3283 tem = shadow_lookup (shadow, kludge, Qt);
3394 3284
3395 if (!NILP (tem)) continue; 3285 if (!NILP (tem)) continue;
@@ -3397,11 +3287,11 @@ describe_vector (vector, elt_prefix, args, elt_describer,
3397 3287
3398 /* Ignore this definition if it is shadowed by an earlier 3288 /* Ignore this definition if it is shadowed by an earlier
3399 one in the same keymap. */ 3289 one in the same keymap. */
3400 if (!NILP (entire_map) && complete_char) 3290 if (!NILP (entire_map))
3401 { 3291 {
3402 Lisp_Object tem; 3292 Lisp_Object tem;
3403 3293
3404 ASET (kludge, 0, make_number (character)); 3294 ASET (kludge, 0, character);
3405 tem = Flookup_key (entire_map, kludge, Qt); 3295 tem = Flookup_key (entire_map, kludge, Qt);
3406 3296
3407 if (!EQ (tem, definition)) 3297 if (!EQ (tem, definition))
@@ -3410,88 +3300,28 @@ describe_vector (vector, elt_prefix, args, elt_describer,
3410 3300
3411 if (first) 3301 if (first)
3412 { 3302 {
3413 if (char_table_depth == 0) 3303 insert ("\n", 1);
3414 insert ("\n", 1);
3415 first = 0; 3304 first = 0;
3416 } 3305 }
3417 3306
3418 /* For a sub char-table, show the depth by indentation.
3419 CHAR_TABLE_DEPTH can be greater than 0 only for a char-table. */
3420 if (char_table_depth > 0)
3421 insert (" ", char_table_depth * 2); /* depth is 1 or 2. */
3422
3423 /* Output the prefix that applies to every entry in this map. */ 3307 /* Output the prefix that applies to every entry in this map. */
3424 if (!NILP (elt_prefix)) 3308 if (!NILP (elt_prefix))
3425 insert1 (elt_prefix); 3309 insert1 (elt_prefix);
3426 3310
3427 /* Insert or describe the character this slot is for, 3311 insert1 (Fsingle_key_description (character, Qnil));
3428 or a description of what it is for. */
3429 if (SUB_CHAR_TABLE_P (vector))
3430 {
3431 if (complete_char)
3432 insert_char (character);
3433 else
3434 {
3435 /* We need an octal representation for this block of
3436 characters. */
3437 char work[16];
3438 sprintf (work, "(row %d)", i);
3439 insert (work, strlen (work));
3440 }
3441 }
3442 else if (CHAR_TABLE_P (vector))
3443 {
3444 if (complete_char)
3445 insert1 (Fsingle_key_description (make_number (character), Qnil));
3446 else
3447 {
3448 /* Print the information for this character set. */
3449 insert_string ("<");
3450 tem2 = CHARSET_TABLE_INFO (i - 128, CHARSET_SHORT_NAME_IDX);
3451 if (STRINGP (tem2))
3452 insert_from_string (tem2, 0, 0, SCHARS (tem2),
3453 SBYTES (tem2), 0);
3454 else
3455 insert ("?", 1);
3456 insert (">", 1);
3457 }
3458 }
3459 else
3460 {
3461 insert1 (Fsingle_key_description (make_number (character), Qnil));
3462 }
3463
3464 /* If we find a sub char-table within a char-table,
3465 scan it recursively; it defines the details for
3466 a character set or a portion of a character set. */
3467 if (CHAR_TABLE_P (vector) && SUB_CHAR_TABLE_P (definition))
3468 {
3469 insert ("\n", 1);
3470 describe_vector (definition, elt_prefix, args, elt_describer,
3471 partial, shadow, entire_map,
3472 indices, char_table_depth + 1);
3473 continue;
3474 }
3475
3476 starting_i = i;
3477 3312
3478 /* Find all consecutive characters or rows that have the same 3313 /* Find all consecutive characters or rows that have the same
3479 definition. But, for elements of a top level char table, if 3314 definition. But, for elements of a top level char table, if
3480 they are for charsets, we had better describe one by one even 3315 they are for charsets, we had better describe one by one even
3481 if they have the same definition. */ 3316 if they have the same definition. */
3482 if (CHAR_TABLE_P (vector)) 3317 if (CHAR_TABLE_P (vector))
3483 { 3318 while (i + 1 < to
3484 int limit = to; 3319 && (val = char_table_ref_and_range (vector, i + 1,
3485 3320 &range_beg, &range_end),
3486 if (char_table_depth == 0) 3321 tem2 = get_keyelt (val, 0),
3487 limit = CHAR_TABLE_SINGLE_BYTE_SLOTS; 3322 !NILP (tem2))
3488 3323 && !NILP (Fequal (tem2, definition)))
3489 while (i + 1 < limit 3324 i = range_end;
3490 && (tem2 = get_keyelt (XCHAR_TABLE (vector)->contents[i + 1], 0),
3491 !NILP (tem2))
3492 && !NILP (Fequal (tem2, definition)))
3493 i++;
3494 }
3495 else 3325 else
3496 while (i + 1 < to 3326 while (i + 1 < to
3497 && (tem2 = get_keyelt (AREF (vector, i + 1), 0), 3327 && (tem2 = get_keyelt (AREF (vector, i + 1), 0),
@@ -3499,7 +3329,6 @@ describe_vector (vector, elt_prefix, args, elt_describer,
3499 && !NILP (Fequal (tem2, definition))) 3329 && !NILP (Fequal (tem2, definition)))
3500 i++; 3330 i++;
3501 3331
3502
3503 /* If we have a range of more than one character, 3332 /* If we have a range of more than one character,
3504 print where the range reaches to. */ 3333 print where the range reaches to. */
3505 3334
@@ -3510,31 +3339,7 @@ describe_vector (vector, elt_prefix, args, elt_describer,
3510 if (!NILP (elt_prefix)) 3339 if (!NILP (elt_prefix))
3511 insert1 (elt_prefix); 3340 insert1 (elt_prefix);
3512 3341
3513 if (CHAR_TABLE_P (vector)) 3342 insert1 (Fsingle_key_description (make_number (i), Qnil));
3514 {
3515 if (char_table_depth == 0)
3516 {
3517 insert1 (Fsingle_key_description (make_number (i), Qnil));
3518 }
3519 else if (complete_char)
3520 {
3521 indices[char_table_depth] = i;
3522 character = MAKE_CHAR (indices[0], indices[1], indices[2]);
3523 insert_char (character);
3524 }
3525 else
3526 {
3527 /* We need an octal representation for this block of
3528 characters. */
3529 char work[16];
3530 sprintf (work, "(row %d)", i);
3531 insert (work, strlen (work));
3532 }
3533 }
3534 else
3535 {
3536 insert1 (Fsingle_key_description (make_number (i), Qnil));
3537 }
3538 } 3343 }
3539 3344
3540 /* Print a description of the definition of this character. 3345 /* Print a description of the definition of this character.
@@ -3543,14 +3348,6 @@ describe_vector (vector, elt_prefix, args, elt_describer,
3543 (*elt_describer) (definition, args); 3348 (*elt_describer) (definition, args);
3544 } 3349 }
3545 3350
3546 /* For (sub) char-table, print `defalt' slot at last. */
3547 if (CHAR_TABLE_P (vector) && !NILP (XCHAR_TABLE (vector)->defalt))
3548 {
3549 insert (" ", char_table_depth * 2);
3550 insert_string ("<<default>>");
3551 (*elt_describer) (XCHAR_TABLE (vector)->defalt, args);
3552 }
3553
3554 UNGCPRO; 3351 UNGCPRO;
3555} 3352}
3556 3353