I found an easy solution: use the
:active properties of the fourth parameter of
Say you have defined a menu like this:
(easy-menu-define org-glaux-menu global-map "Org-glaux"
You can disable it with:
(easy-menu-define nil global-map nil
(list "Org-glaux" :visible nil))
:active also works. It would not be too hard to
warp it into a function:
(defun my/easy-menu-remove (maps menu-name)
"Remove MENU-NAME from the current menu bar."
(easy-menu-define nil maps nil
(list menu-name :visible nil)))
See the documentation of
The first element of MENU must be a string. It is the menu bar
item name. It may be followed by the following keyword argument
INCLUDE is an expression. The menu is visible if the
expression evaluates to a non-nil value. ‘:included’ is an
alias for ‘:visible’.
ENABLE is an expression. The menu is enabled for selection
if the expression evaluates to a non-nil value. ‘:enable’ is
an alias for ‘:active’.
A relevant comment from the documentation of
This function is obsolete since 28.1;
use ‘ignore’ instead.
This function does not change global state, including the match data.
Remove MENU from the current menu bar.
Contrary to XEmacs, this is a nop on Emacs since menus are automatically
(de)activated when the corresponding keymap is (de)activated.