aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarl Heuer1994-03-23 22:50:23 +0000
committerKarl Heuer1994-03-23 22:50:23 +0000
commite9b6dfb0d1dc56bb873ee259e9cf8f8406138479 (patch)
tree10ce866994e6a47813380573bacf93f2784d3eaa /src
parentdd675b05fa02aed16160f15cd26df6519d94d206 (diff)
downloademacs-e9b6dfb0d1dc56bb873ee259e9cf8f8406138479.tar.gz
emacs-e9b6dfb0d1dc56bb873ee259e9cf8f8406138479.zip
(access_keymap, store_in_keymap, Fcopy_keymap, Fdefine_key,
Faccessible_keymaps, Fwhere_is_internal): Use assignment instead of initialization.
Diffstat (limited to 'src')
-rw-r--r--src/keymap.c72
1 files changed, 40 insertions, 32 deletions
diff --git a/src/keymap.c b/src/keymap.c
index 02cc72ae6a0..e5878125c70 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -288,12 +288,14 @@ access_keymap (map, idx, t_ok, noinherit)
288 288
289 { 289 {
290 Lisp_Object tail; 290 Lisp_Object tail;
291 Lisp_Object t_binding = Qnil; 291 Lisp_Object t_binding;
292 292
293 t_binding = Qnil;
293 for (tail = map; CONSP (tail); tail = XCONS (tail)->cdr) 294 for (tail = map; CONSP (tail); tail = XCONS (tail)->cdr)
294 { 295 {
295 Lisp_Object binding = XCONS (tail)->car; 296 Lisp_Object binding;
296 297
298 binding = XCONS (tail)->car;
297 switch (XTYPE (binding)) 299 switch (XTYPE (binding))
298 { 300 {
299 case Lisp_Symbol: 301 case Lisp_Symbol:
@@ -422,12 +424,14 @@ store_in_keymap (keymap, idx, def)
422 towards the front of the alist and character lookups in dense 424 towards the front of the alist and character lookups in dense
423 keymaps will remain fast. Otherwise, this just points at the 425 keymaps will remain fast. Otherwise, this just points at the
424 front of the keymap. */ 426 front of the keymap. */
425 Lisp_Object insertion_point = keymap; 427 Lisp_Object insertion_point;
426 428
429 insertion_point = keymap;
427 for (tail = XCONS (keymap)->cdr; CONSP (tail); tail = XCONS (tail)->cdr) 430 for (tail = XCONS (keymap)->cdr; CONSP (tail); tail = XCONS (tail)->cdr)
428 { 431 {
429 Lisp_Object elt = XCONS (tail)->car; 432 Lisp_Object elt;
430 433
434 elt = XCONS (tail)->car;
431 switch (XTYPE (elt)) 435 switch (XTYPE (elt))
432 { 436 {
433 case Lisp_Vector: 437 case Lisp_Vector:
@@ -488,8 +492,9 @@ is not copied.")
488 492
489 for (tail = copy; CONSP (tail); tail = XCONS (tail)->cdr) 493 for (tail = copy; CONSP (tail); tail = XCONS (tail)->cdr)
490 { 494 {
491 Lisp_Object elt = XCONS (tail)->car; 495 Lisp_Object elt;
492 496
497 elt = XCONS (tail)->car;
493 if (XTYPE (elt) == Lisp_Vector) 498 if (XTYPE (elt) == Lisp_Vector)
494 { 499 {
495 int i; 500 int i;
@@ -630,14 +635,10 @@ the front of KEYMAP.")
630 635
631 keymap = get_keymap_1 (cmd, 0, 1); 636 keymap = get_keymap_1 (cmd, 0, 1);
632 if (NILP (keymap)) 637 if (NILP (keymap))
633 { 638 /* We must use Fkey_description rather than just passing key to
634 /* We must use Fkey_description rather than just passing key to 639 error; key might be a vector, not a string. */
635 error; key might be a vector, not a string. */ 640 error ("Key sequence %s uses invalid prefix characters",
636 Lisp_Object description = Fkey_description (key); 641 XSTRING (Fkey_description (key))->data);
637
638 error ("Key sequence %s uses invalid prefix characters",
639 XSTRING (description)->data);
640 }
641 } 642 }
642} 643}
643 644
@@ -1140,17 +1141,22 @@ then the value includes only maps for prefixes that start with PREFIX.")
1140 1141
1141 for (tail = maps; CONSP (tail); tail = XCONS (tail)->cdr) 1142 for (tail = maps; CONSP (tail); tail = XCONS (tail)->cdr)
1142 { 1143 {
1143 register Lisp_Object thisseq = Fcar (Fcar (tail)); 1144 register Lisp_Object thisseq, thismap;
1144 register Lisp_Object thismap = Fcdr (Fcar (tail)); 1145 Lisp_Object last;
1145 Lisp_Object last = make_number (XINT (Flength (thisseq)) - 1);
1146
1147 /* Does the current sequence end in the meta-prefix-char? */ 1146 /* Does the current sequence end in the meta-prefix-char? */
1148 int is_metized = (XINT (last) >= 0 1147 int is_metized;
1149 && EQ (Faref (thisseq, last), meta_prefix_char)); 1148
1149 thisseq = Fcar (Fcar (tail));
1150 thismap = Fcdr (Fcar (tail));
1151 last = make_number (XINT (Flength (thisseq)) - 1);
1152 is_metized = (XINT (last) >= 0
1153 && EQ (Faref (thisseq, last), meta_prefix_char));
1150 1154
1151 for (; CONSP (thismap); thismap = XCONS (thismap)->cdr) 1155 for (; CONSP (thismap); thismap = XCONS (thismap)->cdr)
1152 { 1156 {
1153 Lisp_Object elt = XCONS (thismap)->car; 1157 Lisp_Object elt;
1158
1159 elt = XCONS (thismap)->car;
1154 1160
1155 QUIT; 1161 QUIT;
1156 1162
@@ -1203,9 +1209,9 @@ then the value includes only maps for prefixes that start with PREFIX.")
1203 } 1209 }
1204 else if (CONSP (elt)) 1210 else if (CONSP (elt))
1205 { 1211 {
1206 register Lisp_Object cmd = get_keyelt (XCONS (elt)->cdr); 1212 register Lisp_Object cmd, tem, filter;
1207 register Lisp_Object tem, filter;
1208 1213
1214 cmd = get_keyelt (XCONS (elt)->cdr);
1209 /* Ignore definitions that aren't keymaps themselves. */ 1215 /* Ignore definitions that aren't keymaps themselves. */
1210 tem = Fkeymapp (cmd); 1216 tem = Fkeymapp (cmd);
1211 if (!NILP (tem)) 1217 if (!NILP (tem))
@@ -1558,11 +1564,8 @@ indirect definition itself.")
1558 1564
1559 for (; !NILP (maps); maps = Fcdr (maps)) 1565 for (; !NILP (maps); maps = Fcdr (maps))
1560 { 1566 {
1561 /* Key sequence to reach map */ 1567 /* Key sequence to reach map, and the map that it reaches */
1562 register Lisp_Object this = Fcar (Fcar (maps)); 1568 register Lisp_Object this, map;
1563
1564 /* The map that it reaches */
1565 register Lisp_Object map = Fcdr (Fcar (maps));
1566 1569
1567 /* If Fcar (map) is a VECTOR, the current element within that vector. */ 1570 /* If Fcar (map) is a VECTOR, the current element within that vector. */
1568 int i = 0; 1571 int i = 0;
@@ -1570,9 +1573,14 @@ indirect definition itself.")
1570 /* In order to fold [META-PREFIX-CHAR CHAR] sequences into 1573 /* In order to fold [META-PREFIX-CHAR CHAR] sequences into
1571 [M-CHAR] sequences, check if last character of the sequence 1574 [M-CHAR] sequences, check if last character of the sequence
1572 is the meta-prefix char. */ 1575 is the meta-prefix char. */
1573 Lisp_Object last = make_number (XINT (Flength (this)) - 1); 1576 Lisp_Object last;
1574 int last_is_meta = (XINT (last) >= 0 1577 int last_is_meta;
1575 && EQ (Faref (this, last), meta_prefix_char)); 1578
1579 this = Fcar (Fcar (maps));
1580 map = Fcdr (Fcar (maps));
1581 last = make_number (XINT (Flength (this)) - 1);
1582 last_is_meta = (XINT (last) >= 0
1583 && EQ (Faref (this, last), meta_prefix_char));
1576 1584
1577 QUIT; 1585 QUIT;
1578 1586
@@ -1587,8 +1595,8 @@ indirect definition itself.")
1587 advance map to the next element until i indicates that we 1595 advance map to the next element until i indicates that we
1588 have finished off the vector. */ 1596 have finished off the vector. */
1589 1597
1590 Lisp_Object elt = XCONS (map)->car; 1598 Lisp_Object elt, key, binding, sequence;
1591 Lisp_Object key, binding, sequence; 1599 elt = XCONS (map)->car;
1592 1600
1593 QUIT; 1601 QUIT;
1594 1602