* [RFC] mconf: suppress empty submenus
@ 2013-05-15 14:05 Dirk Gouders
2013-05-15 14:05 ` [PATCH] " Dirk Gouders
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Dirk Gouders @ 2013-05-15 14:05 UTC (permalink / raw)
To: linux-kbuild
Hello,
I noticed that sometimes it happens that there are empty
submenus, and I tried to see if they can't be suppressed
by mconf (if not explicitely done by the kbuild-language).
Well, I am not sure if someone wants this change and also
if I realized all possible situations and therefore the
patch is not meant to be accepted as is but as a proof-of-concept.
Because of that I implemented the changes as a new function
menu_is_visible_new() and a helper function that walks the whole menu
structure and compares the results of the old and the new function.
I also tried to add coments to the new function which reflect
my understanding but of course might be incomplete or even wrong.
I'd be glad if someone takes the time to test and/or review
the code or comment on the sanity of such a change.
Attached is an example output of the helper function (i.e.
empty dialogs that would be suppressed by the menu_is_visible_new()).
Dirk
------------------------------------------------------------------------
IRQ subsystem is now invisible
Bus devices is now invisible
Texas Instruments shared transport line discipline is now invisible
Microsoft Hyper-V guest support is now invisible
Hardware Spinlock drivers is now invisible
Rpmsg drivers is now invisible
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH] mconf: suppress empty submenus 2013-05-15 14:05 [RFC] mconf: suppress empty submenus Dirk Gouders @ 2013-05-15 14:05 ` Dirk Gouders 2013-05-16 8:24 ` [RFC] " Dirk Gouders 2013-05-16 23:04 ` Yann E. MORIN 2 siblings, 0 replies; 13+ messages in thread From: Dirk Gouders @ 2013-05-15 14:05 UTC (permalink / raw) To: linux-kbuild Empty submenus are at least annoying but could also cause irritation. In general they can be suppressed by the kconfig-language but there might be cases when this becomes challenging. mconf has a function menu_is_visible() that was almost able to identify empty submenus. This function has been modified. Signed-off-by: Dirk Gouders <dirk@gouders.net> --- scripts/kconfig/mconf.c | 5 +++ scripts/kconfig/menu.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 387dc8d..ed7f214 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -22,6 +22,8 @@ #include "lkc.h" #include "lxdialog/dialog.h" +void debug_print_visibles(struct menu *menu); + static const char mconf_readme[] = N_( "Overview\n" "--------\n" @@ -1025,6 +1027,9 @@ int main(int ac, char **av) set_config_filename(conf_get_configname()); conf_set_message_callback(conf_message_callback); + + debug_print_visibles(&rootmenu); + do { conf(&rootmenu, NULL); res = handle_exit(); diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index b5c7d90..c854e5f 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -430,6 +430,94 @@ bool menu_has_prompt(struct menu *menu) return true; } +void debug_print_visibles(struct menu *menu); +bool menu_is_visible_new(struct menu *menu); + +void debug_print_visibles(struct menu *menu) +{ + int diff; + + for (; menu; menu = menu->next) { + if (menu->prompt) { + if ((diff = (menu_is_visible_new(menu) - menu_is_visible(menu)))) + fprintf(stderr, "%s is now %s\n", menu->prompt->text, + diff > 0 ? "visible" : "invisible"); + if (menu->list) { + debug_print_visibles(menu->list); + } + } else { + /* + * Check if there are menu entries without a + * prompt but with a list. + */ + assert(!menu->list); + } + } +} + +bool menu_is_visible_new(struct menu *menu) +{ + struct menu *child; + struct symbol *sym; + tristate visible; + + /* If there is no prompt there nothing to visualize */ + if (!menu->prompt) + return false; + + /* + * If the menu entry has an associated visibility expression + * that evaluates to no, then it beats anything else. + */ + if (menu->visibility) { + if (expr_calc_value(menu->visibility) == no) + return no; + } + + /* Check the prompt's visibility. */ + sym = menu->sym; + if (sym) { + sym_calc_value(sym); + visible = menu->prompt->visible.tri; + } else + visible = menu->prompt->visible.tri = expr_calc_value(menu->prompt->visible.expr); + + /* + * If we are not a menu or we are a menu but also a symbol and + * the calculated visibility is other than no, we're done. + */ + if ((menu->prompt->type != P_MENU || sym) && visible != no) return true; + + /* + * Now, we are probably a visible menue (and no symbol) but + * still have to find out if there is anything visible beneath + * us. If not, we want to be invisible. + * + * Or, we are an invisible symbol and want to be visible if + * there is something visible beneath us. + */ + + /* + * If we are an invisible symbol, we're done. + */ + if (sym && sym_get_tristate_value(menu->sym) == no) + return false; + + /* + * If we find a visible child, we also want to be visible. + * Otherwise we are invisible. + */ + for (child = menu->list; child; child = child->next) { + if (menu_is_visible(child)) { + if (sym) + sym->flags |= SYMBOL_DEF_USER; + return true; + } + } + + return false; +} + bool menu_is_visible(struct menu *menu) { struct menu *child; -- 1.8.2.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [RFC] mconf: suppress empty submenus 2013-05-15 14:05 [RFC] mconf: suppress empty submenus Dirk Gouders 2013-05-15 14:05 ` [PATCH] " Dirk Gouders @ 2013-05-16 8:24 ` Dirk Gouders 2013-05-16 23:04 ` Yann E. MORIN 2 siblings, 0 replies; 13+ messages in thread From: Dirk Gouders @ 2013-05-16 8:24 UTC (permalink / raw) To: linux-kbuild Dirk Gouders <dirk@gouders.net> writes: > Hello, > > I noticed that sometimes it happens that there are empty > submenus, and I tried to see if they can't be suppressed > by mconf (if not explicitely done by the kbuild-language). > > Well, I am not sure if someone wants this change and also > if I realized all possible situations and therefore the > patch is not meant to be accepted as is but as a proof-of-concept. > > Because of that I implemented the changes as a new function > menu_is_visible_new() and a helper function that walks the whole menu > structure and compares the results of the old and the new function. > > I also tried to add coments to the new function which reflect > my understanding but of course might be incomplete or even wrong. > > I'd be glad if someone takes the time to test and/or review > the code or comment on the sanity of such a change. > > Attached is an example output of the helper function (i.e. > empty dialogs that would be suppressed by the menu_is_visible_new()). Sorry, I noticed the first problem with one potential user (nconfig) of such a change: with `nconfig' one cannot enter those hidden empty submenus even when turning on all options with (F4), in which case the submenu wouldn't be empty. So, for a complete proof-of-concept I need to do some more work which I think should also contain a proof that the setting of the SYMBOL_DEF_USER flag behaves exactly the same as before. Dirk PS: In the original message, `sed s/kbuild/kconfig/', of course. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RFC] mconf: suppress empty submenus 2013-05-15 14:05 [RFC] mconf: suppress empty submenus Dirk Gouders 2013-05-15 14:05 ` [PATCH] " Dirk Gouders 2013-05-16 8:24 ` [RFC] " Dirk Gouders @ 2013-05-16 23:04 ` Yann E. MORIN 2013-05-17 4:22 ` Dirk Gouders 2013-05-17 10:28 ` [RFC] mconf: mark empty menus/menuconfigs different form non-empty ones Dirk Gouders 2 siblings, 2 replies; 13+ messages in thread From: Yann E. MORIN @ 2013-05-16 23:04 UTC (permalink / raw) To: Dirk Gouders; +Cc: linux-kbuild Dirk, All, On 2013-05-15 16:05 +0200, Dirk Gouders spake thusly: > I noticed that sometimes it happens that there are empty > submenus, and I tried to see if they can't be suppressed > by mconf (if not explicitely done by the kbuild-language). I think we still want submenus to be visible if they are not hidden by any condition in the Kconfig. If the developper did not explicitly add masking condition, we should *not* try to mask it from the frontends. However, I agree that entering an empty menu can just be deceptive. If we could find a way to render an empty menu, and prevent the user from entering it, then that would be a huge win, I think. For example, menus are rendered as thus for now: This is a submenu ---> What about representing empty submenus as thus: This is a submenu ---- Also, we have menuconfig which are simply empty if not selected, but can anyway be entererd like any other submenu: [ ] menuconfig entry ---> (Always empty when entered if not selected) which could be similarly rendered as: [ ] menuconfig entry ---- This one is really deceptive, and should be handled in the same scheme as well. Any better scheme highly suggested! :-) Regards, Yann E. MORIN. -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RFC] mconf: suppress empty submenus 2013-05-16 23:04 ` Yann E. MORIN @ 2013-05-17 4:22 ` Dirk Gouders 2013-05-17 10:28 ` [RFC] mconf: mark empty menus/menuconfigs different form non-empty ones Dirk Gouders 1 sibling, 0 replies; 13+ messages in thread From: Dirk Gouders @ 2013-05-17 4:22 UTC (permalink / raw) To: Yann E. MORIN; +Cc: linux-kbuild "Yann E. MORIN" <yann.morin.1998@free.fr> writes: > Dirk, All, > > On 2013-05-15 16:05 +0200, Dirk Gouders spake thusly: >> I noticed that sometimes it happens that there are empty >> submenus, and I tried to see if they can't be suppressed >> by mconf (if not explicitely done by the kbuild-language). > > I think we still want submenus to be visible if they are not hidden by > any condition in the Kconfig. If the developper did not explicitly add > masking condition, we should *not* try to mask it from the frontends. > > However, I agree that entering an empty menu can just be deceptive. If > we could find a way to render an empty menu, and prevent the user from > entering it, then that would be a huge win, I think. > > For example, menus are rendered as thus for now: > > This is a submenu ---> > > What about representing empty submenus as thus: > > This is a submenu ---- > > Also, we have menuconfig which are simply empty if not selected, but can > anyway be entererd like any other submenu: > > [ ] menuconfig entry ---> > (Always empty when entered if not selected) > > which could be similarly rendered as: > > [ ] menuconfig entry ---- > > This one is really deceptive, and should be handled in the same scheme > as well. Hello Yann, I like that scheme. Maybe ---- can become ---0 or similar for better perceptibility, but I think what counts would be that the user knows that we know that there are empty menus/menuconfigs and we are treating them properly. What I also like is that I think this scheme would justify a new function "menu_is_empty()" and we do not need to change the current behavior of "menu_is_visible()". While playing with the empty menus, I noticed that there are some more things that probably should be fixed and that I have on my list: * mconf: Using Arrow-Keys should be handled properly (for empty menus) (The point why I thought users get irritated by empty submenus) * mconf: "Z" does not work in empty menus * expr.c: Some days ago, there was a timeslot when "IRQ subsystem" had just one config with a prompt in it and I tried to make the visibility of the menu dependent on the same symbol as the only one config option. That did not work and I found out that this is because of the expr_eliminate_dups* family of functions. I am still figuring out if this is correct behavior or if I just misread the kconfig-language documentation. The attached Kconfig that I use to trigger exactly that point, also outputs an error because of an expression with an unknown type when "Z" is pressed. Dirk ------------------------------------------------------------------------ mainmenu "Kconfig Testing Configuration" config MAY_TEST_VAR def_bool y config SRCARCH string prompt "srcarch" option env="SRCARCH" ---help--- Helptext menu "Testmenu" visible if MAY_TEST_VAR config TEST_VAR bool "Test option" if MAY_TEST_VAR ---help--- Help for TEST_VAR endmenu ^ permalink raw reply [flat|nested] 13+ messages in thread
* [RFC] mconf: mark empty menus/menuconfigs different form non-empty ones 2013-05-16 23:04 ` Yann E. MORIN 2013-05-17 4:22 ` Dirk Gouders @ 2013-05-17 10:28 ` Dirk Gouders 2013-05-17 10:28 ` [PATCH] " Dirk Gouders 2013-05-19 9:08 ` [RFC] mconf: mark empty menus/menuconfigs different form " Yann E. MORIN 1 sibling, 2 replies; 13+ messages in thread From: Dirk Gouders @ 2013-05-17 10:28 UTC (permalink / raw) To: Yann E. MORIN; +Cc: linux-kbuild Hello Yann, all, here is a patch for the scheme you suggested. I also tried how it looks if empty submenus are maked by "---|" but I think that is a matter of personal preferences and I don't want to try to anticipate what users who use mconf heavily want. Dirk ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH] mconf: mark empty menus/menuconfigs different form non-empty ones 2013-05-17 10:28 ` [RFC] mconf: mark empty menus/menuconfigs different form non-empty ones Dirk Gouders @ 2013-05-17 10:28 ` Dirk Gouders 2013-05-17 12:42 ` [PATCH v2] mconf/nconf: mark empty menus/menuconfigs different from " Dirk Gouders 2013-05-19 9:08 ` [RFC] mconf: mark empty menus/menuconfigs different form " Yann E. MORIN 1 sibling, 1 reply; 13+ messages in thread From: Dirk Gouders @ 2013-05-17 10:28 UTC (permalink / raw) To: Yann E. MORIN; +Cc: linux-kbuild Submenus are sometimes empty and it would be nice if there is be somethying that notifies us that we should not expect any content _before_ we enter a submenu. A new function menu_is_empty() was introduced and empty menus and menuconfigs are now marked by "----" as opposed to non-empty ones that are marked by "--->". This scheme was suggested by "Yann E. MORIN" <yann.morin.1998@free.fr>. Signed-off-by: Dirk Gouders <dirk@gouders.net> --- scripts/kconfig/mconf.c | 20 ++++++++++++++------ scripts/kconfig/menu.c | 16 ++++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index ccb71ae..80b289c 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -48,7 +48,7 @@ static const char mconf_readme[] = N_( "----------\n" "o Use the Up/Down arrow keys (cursor keys) to highlight the item\n" " you wish to change or submenu wish to select and press <Enter>.\n" -" Submenus are designated by \"--->\".\n" +" Submenus are designated by \"--->\", empty ones by \"----\".\n" "\n" " Shortcut: Press the option's highlighted letter (hotkey).\n" " Pressing a hotkey more than once will sequence\n" @@ -176,7 +176,7 @@ static const char mconf_readme[] = N_( "\n"), menu_instructions[] = N_( "Arrow keys navigate the menu. " - "<Enter> selects submenus --->. " + "<Enter> selects submenus ---> (or empty submenus ----). " "Highlighted letters are hotkeys. " "Pressing <Y> includes, <N> excludes, <M> modularizes features. " "Press <Esc><Esc> to exit, <?> for Help, </> for Search. " @@ -497,9 +497,14 @@ static void build_conf(struct menu *menu) item_make("%s%*c%s", menu->data ? "-->" : "++>", indent + 1, ' ', prompt); - } else - item_make(" %*c%s --->", indent + 1, ' ', prompt); - + } else { + if (menu_is_empty(menu)) + item_make(" %*c%s ----", + indent + 1, ' ', prompt); + else + item_make(" %*c%s --->", + indent + 1, ' ', prompt); + } item_set_tag('m'); item_set_data(menu); if (single_menu_mode && menu->data) @@ -630,7 +635,10 @@ static void build_conf(struct menu *menu) (sym_has_value(sym) || !sym_is_changable(sym)) ? "" : _(" (NEW)")); if (menu->prompt->type == P_MENU) { - item_add_str(" --->"); + if (menu_is_empty(menu)) + item_add_str(" ----"); + else + item_add_str(" --->"); return; } } diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index b5c7d90..6d11c8f 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -430,6 +430,22 @@ bool menu_has_prompt(struct menu *menu) return true; } +/* + * Determine if a menu is empty. + * A menu is considered empty if it contains no or only + * invisible entries. + */ +bool menu_is_empty(struct menu *menu) +{ + struct menu *child; + + for (child = menu->list; child; child = child->next) { + if (menu_is_visible(child)) + return(false); + } + return(true); +} + bool menu_is_visible(struct menu *menu) { struct menu *child; -- 1.8.2.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2] mconf/nconf: mark empty menus/menuconfigs different from non-empty ones 2013-05-17 10:28 ` [PATCH] " Dirk Gouders @ 2013-05-17 12:42 ` Dirk Gouders 2013-05-19 15:14 ` Yann E. MORIN 0 siblings, 1 reply; 13+ messages in thread From: Dirk Gouders @ 2013-05-17 12:42 UTC (permalink / raw) To: Yann E. MORIN; +Cc: linux-kbuild Submenus are sometimes empty and it would be nice if there is something that notifies us that we should not expect any content _before_ we enter a submenu. A new function menu_is_empty() was introduced and empty menus and menuconfigs are now marked by "----" as opposed to non-empty ones that are marked by "--->". This scheme was suggested by "Yann E. MORIN" <yann.morin.1998@free.fr>. Signed-off-by: Dirk Gouders <dirk@gouders.net> --- scripts/kconfig/lkc_proto.h | 1 + scripts/kconfig/mconf.c | 20 ++++++++++++++------ scripts/kconfig/menu.c | 16 ++++++++++++++++ scripts/kconfig/nconf.c | 30 ++++++++++++++++++++---------- 4 files changed, 51 insertions(+), 16 deletions(-) diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index ef1a738..ecdb965 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h @@ -14,6 +14,7 @@ P(conf_set_message_callback, void,(void (*fn)(const char *fmt, va_list ap))); /* menu.c */ P(rootmenu,struct menu,); +P(menu_is_empty, bool, (struct menu *menu)); P(menu_is_visible, bool, (struct menu *menu)); P(menu_has_prompt, bool, (struct menu *menu)); P(menu_get_prompt,const char *,(struct menu *menu)); diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index ccb71ae..80b289c 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -48,7 +48,7 @@ static const char mconf_readme[] = N_( "----------\n" "o Use the Up/Down arrow keys (cursor keys) to highlight the item\n" " you wish to change or submenu wish to select and press <Enter>.\n" -" Submenus are designated by \"--->\".\n" +" Submenus are designated by \"--->\", empty ones by \"----\".\n" "\n" " Shortcut: Press the option's highlighted letter (hotkey).\n" " Pressing a hotkey more than once will sequence\n" @@ -176,7 +176,7 @@ static const char mconf_readme[] = N_( "\n"), menu_instructions[] = N_( "Arrow keys navigate the menu. " - "<Enter> selects submenus --->. " + "<Enter> selects submenus ---> (or empty submenus ----). " "Highlighted letters are hotkeys. " "Pressing <Y> includes, <N> excludes, <M> modularizes features. " "Press <Esc><Esc> to exit, <?> for Help, </> for Search. " @@ -497,9 +497,14 @@ static void build_conf(struct menu *menu) item_make("%s%*c%s", menu->data ? "-->" : "++>", indent + 1, ' ', prompt); - } else - item_make(" %*c%s --->", indent + 1, ' ', prompt); - + } else { + if (menu_is_empty(menu)) + item_make(" %*c%s ----", + indent + 1, ' ', prompt); + else + item_make(" %*c%s --->", + indent + 1, ' ', prompt); + } item_set_tag('m'); item_set_data(menu); if (single_menu_mode && menu->data) @@ -630,7 +635,10 @@ static void build_conf(struct menu *menu) (sym_has_value(sym) || !sym_is_changable(sym)) ? "" : _(" (NEW)")); if (menu->prompt->type == P_MENU) { - item_add_str(" --->"); + if (menu_is_empty(menu)) + item_add_str(" ----"); + else + item_add_str(" --->"); return; } } diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index b5c7d90..6d11c8f 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -430,6 +430,22 @@ bool menu_has_prompt(struct menu *menu) return true; } +/* + * Determine if a menu is empty. + * A menu is considered empty if it contains no or only + * invisible entries. + */ +bool menu_is_empty(struct menu *menu) +{ + struct menu *child; + + for (child = menu->list; child; child = child->next) { + if (menu_is_visible(child)) + return(false); + } + return(true); +} + bool menu_is_visible(struct menu *menu) { struct menu *child; diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index dbf31ed..8b31180 100644 --- a/scripts/kconfig/nconf.c +++ b/scripts/kconfig/nconf.c @@ -45,8 +45,8 @@ static const char nconf_global_help[] = N_( "<n> to remove it. You may press the <Space> key to cycle through the\n" "available options.\n" "\n" -"A trailing \"--->\" designates a submenu.\n" -"\n" +"A trailing \"--->\" designates a submenu, a trailing \"----\" an\n" +"empty submenu.\n" "\n" "Menu navigation keys\n" "----------------------------------------------------------------------\n" @@ -131,7 +131,7 @@ static const char nconf_global_help[] = N_( "\n"), menu_no_f_instructions[] = N_( "Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" -"Submenus are designated by a trailing \"--->\".\n" +"Submenus are designated by a trailing \"--->\", empty ones by \"----\".\n" "\n" "Use the following keys to navigate the menus:\n" "Move up or down with <Up> and <Down>.\n" @@ -148,7 +148,7 @@ menu_no_f_instructions[] = N_( "For help related to the current menu entry press <?> or <h>.\n"), menu_instructions[] = N_( "Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" -"Submenus are designated by a trailing \"--->\".\n" +"Submenus are designated by a trailing \"--->\", empty ones by \"----\".\n" "\n" "Use the following keys to navigate the menus:\n" "Move up or down with <Up> or <Down>.\n" @@ -757,11 +757,18 @@ static void build_conf(struct menu *menu) "%s%*c%s", menu->data ? "-->" : "++>", indent + 1, ' ', prompt); - } else - item_make(menu, 'm', - " %*c%s --->", - indent + 1, - ' ', prompt); + } else { + if (menu_is_empty(menu)) + item_make(menu, 'm', + " %*c%s ----", + indent + 1, + ' ', prompt); + else + item_make(menu, 'm', + " %*c%s --->", + indent + 1, + ' ', prompt); + } if (single_menu_mode && menu->data) goto conf_childs; @@ -903,7 +910,10 @@ static void build_conf(struct menu *menu) (sym_has_value(sym) || !sym_is_changable(sym)) ? "" : _(" (NEW)")); if (menu->prompt && menu->prompt->type == P_MENU) { - item_add_str(" --->"); + if (menu_is_empty(menu)) + item_add_str(" ----"); + else + item_add_str(" --->"); return; } } -- 1.8.2.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2] mconf/nconf: mark empty menus/menuconfigs different from non-empty ones 2013-05-17 12:42 ` [PATCH v2] mconf/nconf: mark empty menus/menuconfigs different from " Dirk Gouders @ 2013-05-19 15:14 ` Yann E. MORIN 2013-05-19 19:49 ` [PATCH v3] " Dirk Gouders 0 siblings, 1 reply; 13+ messages in thread From: Yann E. MORIN @ 2013-05-19 15:14 UTC (permalink / raw) To: Dirk Gouders; +Cc: linux-kbuild Dirk, All, On 2013-05-17 14:42 +0200, Dirk Gouders spake thusly: > Submenus are sometimes empty and it would be nice if there is > something that notifies us that we should not expect any content > _before_ we enter a submenu. > > A new function menu_is_empty() was introduced and empty menus and > menuconfigs are now marked by "----" as opposed to non-empty > ones that are marked by "--->". > > This scheme was suggested by "Yann E. MORIN" <yann.morin.1998@free.fr>. > > Signed-off-by: Dirk Gouders <dirk@gouders.net> > --- [--SNIP--] > diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c > index ccb71ae..80b289c 100644 > --- a/scripts/kconfig/mconf.c > +++ b/scripts/kconfig/mconf.c [--SNIP--] > @@ -497,9 +497,14 @@ static void build_conf(struct menu *menu) > item_make("%s%*c%s", > menu->data ? "-->" : "++>", > indent + 1, ' ', prompt); > - } else > - item_make(" %*c%s --->", indent + 1, ' ', prompt); > - > + } else { > + if (menu_is_empty(menu)) > + item_make(" %*c%s ----", > + indent + 1, ' ', prompt); > + else > + item_make(" %*c%s --->", > + indent + 1, ' ', prompt); > + } What about: item_make(" %*c%s %s", indent + 1, ' ', prompt, menu_is_empty(menu) ? "----" : "--->" ); [--SNIP--] > diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c > index dbf31ed..8b31180 100644 > --- a/scripts/kconfig/nconf.c > +++ b/scripts/kconfig/nconf.c [--SNIP--] > @@ -757,11 +757,18 @@ static void build_conf(struct menu *menu) > "%s%*c%s", > menu->data ? "-->" : "++>", > indent + 1, ' ', prompt); > - } else > - item_make(menu, 'm', > - " %*c%s --->", > - indent + 1, > - ' ', prompt); > + } else { > + if (menu_is_empty(menu)) > + item_make(menu, 'm', > + " %*c%s ----", > + indent + 1, > + ' ', prompt); > + else > + item_make(menu, 'm', > + " %*c%s --->", > + indent + 1, > + ' ', prompt); > + } Ditto. Otherwise, looks good to me. Regards, Yann E. MORIN. -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3] mconf/nconf: mark empty menus/menuconfigs different from non-empty ones 2013-05-19 15:14 ` Yann E. MORIN @ 2013-05-19 19:49 ` Dirk Gouders 2013-05-20 15:50 ` Yann E. MORIN 0 siblings, 1 reply; 13+ messages in thread From: Dirk Gouders @ 2013-05-19 19:49 UTC (permalink / raw) To: Yann E. MORIN; +Cc: linux-kbuild Submenus are sometimes empty and it would be nice if there is something that notifies us that we should not expect any content _before_ we enter a submenu. A new function menu_is_empty() was introduced and empty menus and menuconfigs are now marked by "----" as opposed to non-empty ones that are marked by "--->". This scheme was suggested by "Yann E. MORIN" <yann.morin.1998@free.fr>. Signed-off-by: Dirk Gouders <dirk@gouders.net> --- scripts/kconfig/lkc_proto.h | 1 + scripts/kconfig/mconf.c | 11 ++++++----- scripts/kconfig/menu.c | 16 ++++++++++++++++ scripts/kconfig/nconf.c | 16 ++++++++-------- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index ef1a738..ecdb965 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h @@ -14,6 +14,7 @@ P(conf_set_message_callback, void,(void (*fn)(const char *fmt, va_list ap))); /* menu.c */ P(rootmenu,struct menu,); +P(menu_is_empty, bool, (struct menu *menu)); P(menu_is_visible, bool, (struct menu *menu)); P(menu_has_prompt, bool, (struct menu *menu)); P(menu_get_prompt,const char *,(struct menu *menu)); diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 387dc8d..d40e293 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -48,7 +48,7 @@ static const char mconf_readme[] = N_( "----------\n" "o Use the Up/Down arrow keys (cursor keys) to highlight the item\n" " you wish to change or submenu wish to select and press <Enter>.\n" -" Submenus are designated by \"--->\".\n" +" Submenus are designated by \"--->\", empty ones by \"----\".\n" "\n" " Shortcut: Press the option's highlighted letter (hotkey).\n" " Pressing a hotkey more than once will sequence\n" @@ -176,7 +176,7 @@ static const char mconf_readme[] = N_( "\n"), menu_instructions[] = N_( "Arrow keys navigate the menu. " - "<Enter> selects submenus --->. " + "<Enter> selects submenus ---> (or empty submenus ----). " "Highlighted letters are hotkeys. " "Pressing <Y> includes, <N> excludes, <M> modularizes features. " "Press <Esc><Esc> to exit, <?> for Help, </> for Search. " @@ -498,8 +498,9 @@ static void build_conf(struct menu *menu) menu->data ? "-->" : "++>", indent + 1, ' ', prompt); } else - item_make(" %*c%s --->", indent + 1, ' ', prompt); - + item_make(" %*c%s %s", + indent + 1, ' ', prompt, + menu_is_empty(menu) ? "----" : "--->"); item_set_tag('m'); item_set_data(menu); if (single_menu_mode && menu->data) @@ -630,7 +631,7 @@ static void build_conf(struct menu *menu) (sym_has_value(sym) || !sym_is_changable(sym)) ? "" : _(" (NEW)")); if (menu->prompt->type == P_MENU) { - item_add_str(" --->"); + item_add_str(" %s", menu_is_empty(menu) ? "----" : "--->"); return; } } diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index b5c7d90..6d11c8f 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -430,6 +430,22 @@ bool menu_has_prompt(struct menu *menu) return true; } +/* + * Determine if a menu is empty. + * A menu is considered empty if it contains no or only + * invisible entries. + */ +bool menu_is_empty(struct menu *menu) +{ + struct menu *child; + + for (child = menu->list; child; child = child->next) { + if (menu_is_visible(child)) + return(false); + } + return(true); +} + bool menu_is_visible(struct menu *menu) { struct menu *child; diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index dbf31ed..0bd62cc 100644 --- a/scripts/kconfig/nconf.c +++ b/scripts/kconfig/nconf.c @@ -45,8 +45,8 @@ static const char nconf_global_help[] = N_( "<n> to remove it. You may press the <Space> key to cycle through the\n" "available options.\n" "\n" -"A trailing \"--->\" designates a submenu.\n" -"\n" +"A trailing \"--->\" designates a submenu, a trailing \"----\" an\n" +"empty submenu.\n" "\n" "Menu navigation keys\n" "----------------------------------------------------------------------\n" @@ -131,7 +131,7 @@ static const char nconf_global_help[] = N_( "\n"), menu_no_f_instructions[] = N_( "Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" -"Submenus are designated by a trailing \"--->\".\n" +"Submenus are designated by a trailing \"--->\", empty ones by \"----\".\n" "\n" "Use the following keys to navigate the menus:\n" "Move up or down with <Up> and <Down>.\n" @@ -148,7 +148,7 @@ menu_no_f_instructions[] = N_( "For help related to the current menu entry press <?> or <h>.\n"), menu_instructions[] = N_( "Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" -"Submenus are designated by a trailing \"--->\".\n" +"Submenus are designated by a trailing \"--->\", empty ones by \"----\".\n" "\n" "Use the following keys to navigate the menus:\n" "Move up or down with <Up> or <Down>.\n" @@ -759,9 +759,9 @@ static void build_conf(struct menu *menu) indent + 1, ' ', prompt); } else item_make(menu, 'm', - " %*c%s --->", - indent + 1, - ' ', prompt); + " %*c%s %s", + indent + 1, ' ', prompt, + menu_is_empty(menu) ? "----" : "--->"); if (single_menu_mode && menu->data) goto conf_childs; @@ -903,7 +903,7 @@ static void build_conf(struct menu *menu) (sym_has_value(sym) || !sym_is_changable(sym)) ? "" : _(" (NEW)")); if (menu->prompt && menu->prompt->type == P_MENU) { - item_add_str(" --->"); + item_add_str(" %s", menu_is_empty(menu) ? "----" : "--->"); return; } } -- 1.8.2.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3] mconf/nconf: mark empty menus/menuconfigs different from non-empty ones 2013-05-19 19:49 ` [PATCH v3] " Dirk Gouders @ 2013-05-20 15:50 ` Yann E. MORIN 0 siblings, 0 replies; 13+ messages in thread From: Yann E. MORIN @ 2013-05-20 15:50 UTC (permalink / raw) To: Dirk Gouders; +Cc: linux-kbuild Dirk, All, On 2013-05-19 21:49 +0200, Dirk Gouders spake thusly: > Submenus are sometimes empty and it would be nice if there is > something that notifies us that we should not expect any content > _before_ we enter a submenu. > > A new function menu_is_empty() was introduced and empty menus and > menuconfigs are now marked by "----" as opposed to non-empty ones that > are marked by "--->". > > This scheme was suggested by "Yann E. MORIN" > <yann.morin.1998@free.fr>. > > Signed-off-by: Dirk Gouders <dirk@gouders.net> I've applied this to my tree in my yem-kconfig-for-next branch, for inclusion when the merge window for 3.11 opens. Thank you! Regards, Yann E. MORIN. -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RFC] mconf: mark empty menus/menuconfigs different form non-empty ones 2013-05-17 10:28 ` [RFC] mconf: mark empty menus/menuconfigs different form non-empty ones Dirk Gouders 2013-05-17 10:28 ` [PATCH] " Dirk Gouders @ 2013-05-19 9:08 ` Yann E. MORIN 2013-05-19 16:22 ` Dirk Gouders 1 sibling, 1 reply; 13+ messages in thread From: Yann E. MORIN @ 2013-05-19 9:08 UTC (permalink / raw) To: Dirk Gouders; +Cc: linux-kbuild Dirk, All, On 2013-05-17 12:28 +0200, Dirk Gouders spake thusly: > here is a patch for the scheme you suggested. > > I also tried how it looks if empty submenus are maked by "---|" but I > think that is a matter of personal preferences and I don't want to try to > anticipate what users who use mconf heavily want. I suggested '----' to floow the scheme for booleans and tristates: [ ] Selectable boolean < > Selectable tristate { } Selectable tristate, forced to at least M - - Unselectable tristate, forced to Y So I think '----' is a nice fit for '--->'. Regards, Yann E. MORIN. -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [RFC] mconf: mark empty menus/menuconfigs different form non-empty ones 2013-05-19 9:08 ` [RFC] mconf: mark empty menus/menuconfigs different form " Yann E. MORIN @ 2013-05-19 16:22 ` Dirk Gouders 0 siblings, 0 replies; 13+ messages in thread From: Dirk Gouders @ 2013-05-19 16:22 UTC (permalink / raw) To: Yann E. MORIN; +Cc: linux-kbuild "Yann E. MORIN" <yann.morin.1998@free.fr> writes: > Dirk, All, > > On 2013-05-17 12:28 +0200, Dirk Gouders spake thusly: >> here is a patch for the scheme you suggested. >> >> I also tried how it looks if empty submenus are maked by "---|" but I >> think that is a matter of personal preferences and I don't want to try to >> anticipate what users who use mconf heavily want. > > I suggested '----' to floow the scheme for booleans and tristates: > [ ] Selectable boolean > < > Selectable tristate > { } Selectable tristate, forced to at least M > - - Unselectable tristate, forced to Y > > So I think '----' is a nice fit for '--->'. Thanks for the explatation, Yann. Now, I understand why you suggested exactly that scheme. Dirk ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2013-05-20 15:50 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-05-15 14:05 [RFC] mconf: suppress empty submenus Dirk Gouders 2013-05-15 14:05 ` [PATCH] " Dirk Gouders 2013-05-16 8:24 ` [RFC] " Dirk Gouders 2013-05-16 23:04 ` Yann E. MORIN 2013-05-17 4:22 ` Dirk Gouders 2013-05-17 10:28 ` [RFC] mconf: mark empty menus/menuconfigs different form non-empty ones Dirk Gouders 2013-05-17 10:28 ` [PATCH] " Dirk Gouders 2013-05-17 12:42 ` [PATCH v2] mconf/nconf: mark empty menus/menuconfigs different from " Dirk Gouders 2013-05-19 15:14 ` Yann E. MORIN 2013-05-19 19:49 ` [PATCH v3] " Dirk Gouders 2013-05-20 15:50 ` Yann E. MORIN 2013-05-19 9:08 ` [RFC] mconf: mark empty menus/menuconfigs different form " Yann E. MORIN 2013-05-19 16:22 ` Dirk Gouders
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox