aboutsummaryrefslogtreecommitdiffstats
path: root/src/keymap.c
diff options
context:
space:
mode:
authorRichard M. Stallman1994-04-09 21:09:34 +0000
committerRichard M. Stallman1994-04-09 21:09:34 +0000
commit224a16e88e0cdf64e87f7410b149f07d187e0030 (patch)
tree1bee8a0a4415bdd3aa864018903f95f321fdaa96 /src/keymap.c
parent61df1a5e99b1204818220d3ae45a824e4982f302 (diff)
downloademacs-224a16e88e0cdf64e87f7410b149f07d187e0030.tar.gz
emacs-224a16e88e0cdf64e87f7410b149f07d187e0030.zip
(get_keymap): Pass 1 as ERROR to get_keymap_1.
(get_keyelt): New arg AUTOLOAD means load keymaps indirected thru. All callers changed; most pass 0. (Fdefine_key, Flookup_key): Load all the keymaps we look in.
Diffstat (limited to 'src/keymap.c')
-rw-r--r--src/keymap.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/keymap.c b/src/keymap.c
index f6e5b443fe2..5fbd5de3456 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -246,7 +246,7 @@ Lisp_Object
246get_keymap (object) 246get_keymap (object)
247 Lisp_Object object; 247 Lisp_Object object;
248{ 248{
249 return get_keymap_1 (object, 0, 0); 249 return get_keymap_1 (object, 1, 0);
250} 250}
251 251
252 252
@@ -344,18 +344,22 @@ access_keymap (map, idx, t_ok, noinherit)
344 and INDEX is the object to look up in KEYMAP to yield the definition. 344 and INDEX is the object to look up in KEYMAP to yield the definition.
345 345
346 Also if OBJECT has a menu string as the first element, 346 Also if OBJECT has a menu string as the first element,
347 remove that. Also remove a menu help string as second element. */ 347 remove that. Also remove a menu help string as second element.
348
349 If AUTOLOAD is nonzero, load autoloadable keymaps
350 that are referred to with indirection. */
348 351
349Lisp_Object 352Lisp_Object
350get_keyelt (object) 353get_keyelt (object, autoload)
351 register Lisp_Object object; 354 register Lisp_Object object;
355 int autoload;
352{ 356{
353 while (1) 357 while (1)
354 { 358 {
355 register Lisp_Object map, tem; 359 register Lisp_Object map, tem;
356 360
357 /* If the contents are (KEYMAP . ELEMENT), go indirect. */ 361 /* If the contents are (KEYMAP . ELEMENT), go indirect. */
358 map = get_keymap_1 (Fcar_safe (object), 0, 0); 362 map = get_keymap_1 (Fcar_safe (object), 0, autoload);
359 tem = Fkeymapp (map); 363 tem = Fkeymapp (map);
360 if (!NILP (tem)) 364 if (!NILP (tem))
361 object = access_keymap (map, Fcdr (object), 0, 0); 365 object = access_keymap (map, Fcdr (object), 0, 0);
@@ -583,7 +587,7 @@ the front of KEYMAP.")
583 int length; 587 int length;
584 struct gcpro gcpro1, gcpro2, gcpro3; 588 struct gcpro gcpro1, gcpro2, gcpro3;
585 589
586 keymap = get_keymap (keymap); 590 keymap = get_keymap_1 (keymap, 1, 1);
587 591
588 if (XTYPE (key) != Lisp_Vector 592 if (XTYPE (key) != Lisp_Vector
589 && XTYPE (key) != Lisp_String) 593 && XTYPE (key) != Lisp_String)
@@ -627,7 +631,7 @@ the front of KEYMAP.")
627 if (idx == length) 631 if (idx == length)
628 RETURN_UNGCPRO (store_in_keymap (keymap, c, def)); 632 RETURN_UNGCPRO (store_in_keymap (keymap, c, def));
629 633
630 cmd = get_keyelt (access_keymap (keymap, c, 0, 1)); 634 cmd = get_keyelt (access_keymap (keymap, c, 0, 1), 1);
631 635
632 /* If this key is undefined, make it a prefix. */ 636 /* If this key is undefined, make it a prefix. */
633 if (NILP (cmd)) 637 if (NILP (cmd))
@@ -673,7 +677,7 @@ recognize the default bindings, just as `read-key-sequence' does.")
673 int t_ok = ! NILP (accept_default); 677 int t_ok = ! NILP (accept_default);
674 int meta_bit; 678 int meta_bit;
675 679
676 keymap = get_keymap (keymap); 680 keymap = get_keymap_1 (keymap, 1, 1);
677 681
678 if (XTYPE (key) != Lisp_Vector 682 if (XTYPE (key) != Lisp_Vector
679 && XTYPE (key) != Lisp_String) 683 && XTYPE (key) != Lisp_String)
@@ -709,11 +713,11 @@ recognize the default bindings, just as `read-key-sequence' does.")
709 idx++; 713 idx++;
710 } 714 }
711 715
712 cmd = get_keyelt (access_keymap (keymap, c, t_ok, 0)); 716 cmd = get_keyelt (access_keymap (keymap, c, t_ok, 0), 1);
713 if (idx == length) 717 if (idx == length)
714 return cmd; 718 return cmd;
715 719
716 keymap = get_keymap_1 (cmd, 0, 0); 720 keymap = get_keymap_1 (cmd, 0, 1);
717 if (NILP (keymap)) 721 if (NILP (keymap))
718 return make_number (idx); 722 return make_number (idx);
719 723
@@ -1170,7 +1174,7 @@ then the value includes only maps for prefixes that start with PREFIX.")
1170 register Lisp_Object tem; 1174 register Lisp_Object tem;
1171 register Lisp_Object cmd; 1175 register Lisp_Object cmd;
1172 1176
1173 cmd = get_keyelt (XVECTOR (elt)->contents[i]); 1177 cmd = get_keyelt (XVECTOR (elt)->contents[i], 0);
1174 if (NILP (cmd)) continue; 1178 if (NILP (cmd)) continue;
1175 tem = Fkeymapp (cmd); 1179 tem = Fkeymapp (cmd);
1176 if (!NILP (tem)) 1180 if (!NILP (tem))
@@ -1211,7 +1215,7 @@ then the value includes only maps for prefixes that start with PREFIX.")
1211 { 1215 {
1212 register Lisp_Object cmd, tem, filter; 1216 register Lisp_Object cmd, tem, filter;
1213 1217
1214 cmd = get_keyelt (XCONS (elt)->cdr); 1218 cmd = get_keyelt (XCONS (elt)->cdr, 0);
1215 /* Ignore definitions that aren't keymaps themselves. */ 1219 /* Ignore definitions that aren't keymaps themselves. */
1216 tem = Fkeymapp (cmd); 1220 tem = Fkeymapp (cmd);
1217 if (!NILP (tem)) 1221 if (!NILP (tem))
@@ -1635,7 +1639,7 @@ indirect definition itself.")
1635 1639
1636 /* Search through indirections unless that's not wanted. */ 1640 /* Search through indirections unless that's not wanted. */
1637 if (NILP (noindirect)) 1641 if (NILP (noindirect))
1638 binding = get_keyelt (binding); 1642 binding = get_keyelt (binding, 0);
1639 1643
1640 /* End this iteration if this element does not match 1644 /* End this iteration if this element does not match
1641 the target. */ 1645 the target. */
@@ -2082,7 +2086,7 @@ describe_map_2 (keymap, elt_prefix, elt_describer, partial, shadow)
2082 else 2086 else
2083 { 2087 {
2084 event = Fcar_safe (Fcar (tail)); 2088 event = Fcar_safe (Fcar (tail));
2085 definition = get_keyelt (Fcdr_safe (Fcar (tail))); 2089 definition = get_keyelt (Fcdr_safe (Fcar (tail)), 0);
2086 2090
2087 /* Don't show undefined commands or suppressed commands. */ 2091 /* Don't show undefined commands or suppressed commands. */
2088 if (NILP (definition)) continue; 2092 if (NILP (definition)) continue;
@@ -2182,7 +2186,7 @@ describe_vector (vector, elt_prefix, elt_describer, partial, shadow)
2182 for (i = 0; i < XVECTOR (vector)->size; i++) 2186 for (i = 0; i < XVECTOR (vector)->size; i++)
2183 { 2187 {
2184 QUIT; 2188 QUIT;
2185 tem1 = get_keyelt (XVECTOR (vector)->contents[i]); 2189 tem1 = get_keyelt (XVECTOR (vector)->contents[i], 0);
2186 2190
2187 if (NILP (tem1)) continue; 2191 if (NILP (tem1)) continue;
2188 2192
@@ -2225,7 +2229,7 @@ describe_vector (vector, elt_prefix, elt_describer, partial, shadow)
2225 2229
2226 /* Find all consecutive characters that have the same definition. */ 2230 /* Find all consecutive characters that have the same definition. */
2227 while (i + 1 < XVECTOR (vector)->size 2231 while (i + 1 < XVECTOR (vector)->size
2228 && (tem2 = get_keyelt (XVECTOR (vector)->contents[i+1]), 2232 && (tem2 = get_keyelt (XVECTOR (vector)->contents[i+1], 0),
2229 EQ (tem2, tem1))) 2233 EQ (tem2, tem1)))
2230 i++; 2234 i++;
2231 2235