Skip to contentSkip to conversation

mconf: suppress empty submenus

RFC New Dirk Gouders 2 participants 13 messages May 15, 2013 – May 20, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

PATCH 1/1 mconf: suppress empty submenus

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.

---
 scripts/kconfig/mconf.c |  5 +++
 scripts/kconfig/menu.c  | 88 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 93 insertions(+)
scripts/kconfig/mconf.c +5 -0
index 387dc8d..ed7f214 100644
@@ -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();
scripts/kconfig/menu.c +88 -0

94 lines not on this page · raw message

Signature · 1 line
1.8.2.1
#2 lore raw
In reply to Dirk Gouders
Quoted 14 lines · Dirk Gouders

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.

Quoted 8 lines

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.

#3 lore raw
In reply to Dirk Gouders

Dirk, All,

On 2013-05-15 16:05 +0200, Dirk Gouders spake thusly:

Quoted 3 lines

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.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw
Quoted 29 lines · Yann E. MORIN

Dirk, All,

On 2013-05-15 16:05 +0200, Dirk Gouders spake thusly:

Quoted 3 lines

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)

Quoted 6 lines

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

#5 lore raw

[RFC] mconf: mark empty menus/menuconfigs different form non-empty ones

In reply to Yann E. MORIN

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

#6 lore raw

PATCH 1/1 mconf: mark empty menus/menuconfigs different form non-empty ones

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" <[email protected]>.

---
 scripts/kconfig/mconf.c | 20 ++++++++++++++------
 scripts/kconfig/menu.c  | 16 ++++++++++++++++
 2 files changed, 30 insertions(+), 6 deletions(-)
scripts/kconfig/mconf.c +14 -6
index ccb71ae..80b289c 100644
@@ -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;
 		}
 	}
scripts/kconfig/menu.c +16 -0
index b5c7d90..6d11c8f 100644
@@ -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;
Signature · 1 line
1.8.2.1
#7 lore raw

PATCH v2 1/1 mconf/nconf: mark empty menus/menuconfigs different from non-empty ones

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" <[email protected]>.

---
 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(-)
scripts/kconfig/lkc_proto.h +1 -0
index ef1a738..ecdb965 100644
@@ -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));
scripts/kconfig/mconf.c +14 -6
index ccb71ae..80b289c 100644
@@ -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;
 		}
 	}
scripts/kconfig/menu.c +16 -0
index b5c7d90..6d11c8f 100644
@@ -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;
scripts/kconfig/nconf.c +20 -10
index dbf31ed..8b31180 100644
@@ -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;
 		}
 	}
Signature · 1 line
1.8.2.1
#8 lore raw

Re: [PATCH v2] mconf/nconf: mark empty menus/menuconfigs different from non-empty ones

Dirk, All,

On 2013-05-17 14:42 +0200, Dirk Gouders spake thusly:

Quoted 4 lines

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.

Quoted 8 lines

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" <[email protected]>.

---

[--SNIP--]

scripts/kconfig/mconf.c

Quoted 4 lines
scripts/kconfig/mconf.c +0 -0
index ccb71ae..80b289c 100644

[--SNIP--]

Quoted 5 lines
scripts/kconfig/mconf.c +0 -1
@@ -497,9 +497,14 @@ static void build_conf(struct menu *menu)
 					item_make("%s%*c%s",
 						  menu->data ? "-->" : "++>",
 						  indent + 1, ' ', prompt);
-				} else

scripts/kconfig/mconf.c static void build_conf(struct menu *menu) · line 507

Quoted 10 lines
scripts/kconfig/mconf.c +8 -2
-					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--]

scripts/kconfig/nconf.c

Quoted 4 lines
scripts/kconfig/nconf.c +0 -0
index dbf31ed..8b31180 100644

[--SNIP--]

Quoted 11 lines
scripts/kconfig/nconf.c +2 -5
@@ -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))

scripts/kconfig/nconf.c static void build_conf(struct menu *menu) · line 771

Quoted 10 lines
scripts/kconfig/nconf.c +10 -0
+						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.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'
#9 lore raw

PATCH v3 1/1 mconf/nconf: mark empty menus/menuconfigs different from non-empty ones

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"
<[email protected]>.

---
 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(-)
scripts/kconfig/lkc_proto.h +1 -0
index ef1a738..ecdb965 100644
@@ -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));
scripts/kconfig/mconf.c +6 -5
index 387dc8d..d40e293 100644
@@ -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;
 		}
 	}
scripts/kconfig/menu.c +16 -0
index b5c7d90..6d11c8f 100644
@@ -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;
scripts/kconfig/nconf.c +8 -8
index dbf31ed..0bd62cc 100644
@@ -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;
 		}
 	}
Signature · 1 line
1.8.2.1
#10 lore raw

Re: [PATCH v3] mconf/nconf: mark empty menus/menuconfigs different from non-empty ones

Dirk, All,

On 2013-05-19 21:49 +0200, Dirk Gouders spake thusly:

Quoted 4 lines

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.

Quoted 8 lines

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"
<[email protected]>.

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.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'
#11 lore raw

Re: [RFC] mconf: mark empty menus/menuconfigs different form non-empty ones

In reply to Dirk Gouders

Dirk, All,

On 2013-05-17 12:28 +0200, Dirk Gouders spake thusly:

Quoted 5 lines

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.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'
#12 lore raw

Re: [RFC] mconf: mark empty menus/menuconfigs different form non-empty ones

Quoted 9 lines · Yann E. MORIN

Dirk, All,

On 2013-05-17 12:28 +0200, Dirk Gouders spake thusly:

Quoted 5 lines

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.

Quoted 7 lines

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