aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1996-12-26 21:06:19 +0000
committerRichard M. Stallman1996-12-26 21:06:19 +0000
commit98381e4289c6694853b4f1fbd2154eca0dc27069 (patch)
tree9f6620ef3da477bb5ddb3162432eab48cd945513 /src
parent101d1605856e8165700fa626005260e6f0508010 (diff)
downloademacs-98381e4289c6694853b4f1fbd2154eca0dc27069.tar.gz
emacs-98381e4289c6694853b4f1fbd2154eca0dc27069.zip
(single_keymap_panes): New arg DEPTH.
Cut off recursion at that depth. Callers changed.
Diffstat (limited to 'src')
-rw-r--r--src/xmenu.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/xmenu.c b/src/xmenu.c
index fee4e97347e..819f81ea954 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -504,7 +504,7 @@ keymap_panes (keymaps, nmaps, notreal)
504 But don't make a pane that is empty--ignore that map instead. 504 But don't make a pane that is empty--ignore that map instead.
505 P is the number of panes we have made so far. */ 505 P is the number of panes we have made so far. */
506 for (mapno = 0; mapno < nmaps; mapno++) 506 for (mapno = 0; mapno < nmaps; mapno++)
507 single_keymap_panes (keymaps[mapno], Qnil, Qnil, notreal); 507 single_keymap_panes (keymaps[mapno], Qnil, Qnil, notreal, 10);
508 508
509 finish_menu_items (); 509 finish_menu_items ();
510} 510}
@@ -514,19 +514,25 @@ keymap_panes (keymaps, nmaps, notreal)
514 The other arguments are passed along 514 The other arguments are passed along
515 or point to local variables of the previous function. 515 or point to local variables of the previous function.
516 If NOTREAL is nonzero, 516 If NOTREAL is nonzero,
517 don't bother really computing whether an item is enabled. */ 517 don't bother really computing whether an item is enabled.
518
519 If we encounter submenus deeper than MAXDEPTH levels, ignore them. */
518 520
519static void 521static void
520single_keymap_panes (keymap, pane_name, prefix, notreal) 522single_keymap_panes (keymap, pane_name, prefix, notreal, maxdepth)
521 Lisp_Object keymap; 523 Lisp_Object keymap;
522 Lisp_Object pane_name; 524 Lisp_Object pane_name;
523 Lisp_Object prefix; 525 Lisp_Object prefix;
524 int notreal; 526 int notreal;
527 int maxdepth;
525{ 528{
526 Lisp_Object pending_maps; 529 Lisp_Object pending_maps;
527 Lisp_Object tail, item, item1, item_string, table; 530 Lisp_Object tail, item, item1, item_string, table;
528 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 531 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
529 532
533 if (maxdepth <= 0)
534 return;
535
530 pending_maps = Qnil; 536 pending_maps = Qnil;
531 537
532 push_menu_pane (pane_name, prefix); 538 push_menu_pane (pane_name, prefix);
@@ -593,7 +599,8 @@ single_keymap_panes (keymap, pane_name, prefix, notreal)
593 { 599 {
594 push_submenu_start (); 600 push_submenu_start ();
595 single_keymap_panes (submap, Qnil, 601 single_keymap_panes (submap, Qnil,
596 XCONS (item)->car, notreal); 602 XCONS (item)->car, notreal,
603 maxdepth - 1);
597 push_submenu_end (); 604 push_submenu_end ();
598 } 605 }
599#endif 606#endif
@@ -662,7 +669,8 @@ single_keymap_panes (keymap, pane_name, prefix, notreal)
662 { 669 {
663 push_submenu_start (); 670 push_submenu_start ();
664 single_keymap_panes (submap, Qnil, 671 single_keymap_panes (submap, Qnil,
665 character, notreal); 672 character, notreal,
673 maxdepth - 1);
666 push_submenu_end (); 674 push_submenu_end ();
667 } 675 }
668#endif 676#endif
@@ -683,7 +691,7 @@ single_keymap_panes (keymap, pane_name, prefix, notreal)
683 /* We no longer discard the @ from the beginning of the string here. 691 /* We no longer discard the @ from the beginning of the string here.
684 Instead, we do this in xmenu_show. */ 692 Instead, we do this in xmenu_show. */
685 single_keymap_panes (Fcar (elt), string, 693 single_keymap_panes (Fcar (elt), string,
686 XCONS (eltcdr)->cdr, notreal); 694 XCONS (eltcdr)->cdr, notreal, maxdepth - 1);
687 pending_maps = Fcdr (pending_maps); 695 pending_maps = Fcdr (pending_maps);
688 } 696 }
689} 697}
@@ -1425,7 +1433,7 @@ single_submenu (item_key, item_name, maps)
1425 push_menu_item (item_name, Qt, item_key, mapvec[i], Qnil); 1433 push_menu_item (item_name, Qt, item_key, mapvec[i], Qnil);
1426 } 1434 }
1427 else 1435 else
1428 single_keymap_panes (mapvec[i], item_name, item_key, 0); 1436 single_keymap_panes (mapvec[i], item_name, item_key, 0, 10);
1429 } 1437 }
1430 1438
1431 /* Create a tree of widget_value objects 1439 /* Create a tree of widget_value objects