In the default Emacs menubar (menu-bar.el), a lot of menu items are defined the following way:
[...]
'(menu-item "Menu item" foo
:enable (and (menu-bar-menu-frame-live-and-visible-p)
(menu-bar-non-minibuffer-window-p))
My question is: what are these :enable conditions for?
EDIT: I'm asking specifically what these two functions are for and why they are used in many menu items. Why would you add this to your menu item?
The documentation of menu-bar-non-minibuffer-window-p
says:
Return non-nil if the menu frame's selected window is no minibuffer window. Return nil if the menu frame is dead or its selected window is a minibuffer window.
OK, so the menu item is disabled if the minibuffer is active. But what does it mean that a frame is "dead"?
menu-bar-menu-frame-live-and-visible-p
is even more cryptic:
Return non-nil if the menu frame is alive and visible.
What does it mean that a frame is "alive and visible"? (Why would you need to disable a menu item if a frame is not visible, e.g. because it's iconified? Or does this mean something completely different?)
The reason to ask this is in part curiosity (I've been unable to find any further description of these functions) and in part because, say, you want to write a menu for a minor mode or just add something to the menubar: do you need to add them to the :enable
keyword? When should they be used?