Subject: bug#14021: Activation of both Semantic and EDE disables their common submenu in main emacs menu, leaving it available only in visible menu bar

From: David Engster <[email-masked]>
Date: Fri, 22 Mar 2013 08:51:10 +0100

Nikita Zlobin writes:
> This bug happened for me in two places: in tmm menu, opened by command
> tmm-menu (no matter, is menubar enabled or not), and its popup variant,
> which may be opened by C-Mouse3 if menubar is disabled.
>
> When only one of these two modes is enabled (either semantic or EDE),
> menu is available, but after activation of remaining one submenu turns
> to inactive usual menu item. But disabling of one mode, makes submenu
> available again in both places.

Since it took me quite some time to understand this, here's a recipe:

* emacs -Q

* M-x menu-bar-mode, so that menu-bar is disabled

* M-x semantic-mode

* M-x global-ede-mode

* Now do C-Mouse 3 to open the "global menu" popup (which I didn't know
  existed until yesterday...)

Look at the "Development" menu at the bottom. It might be disabled. If
not, try the recipe again - it seems to be a race condition.

If the item is disabled, turn on the menu-bar, and you'll see that the
Development menu there is working just fine.

The culprit is this: Both minor-modes, semantic and ede, should use the
"Development" menu, but you can use one or the other or both
together. This hack in semantic.el is used to accomplish this:

    (define-key map [menu-bar cedet-menu]
      (list 'menu-item "Development" cedet-menu-map
	    :enable (quote (not (bound-and-true-p global-ede-mode)))))

If you remove the :enable clause, the menu-bar displays two "CEDET-menu"
items underneath "Development", which is what this hack avoids. (Note
however that the "Global menu" popup will display correctly in this
case, so there's the first inconsistency between the two).

With this hack, the menu-bar works fine. It seems however that the
"Global Menu" popup displays *either* the item from Semantic *or* the
one from EDE, but only the latter is enabled. This is also where I guess
the race is happening.

I hope this information is sufficient to track this down. Otherwise I'll
try to come up with an isolated test case.

BTW, I managed to workaround this issue in CEDET trunk by using

	    :enable (quote (not (and menu-bar-mode
				     (bound-and-true-p global-ede-mode))))))

-David