Previous: , Up: Menu Accelerators   [Contents][Index]


27.7.3 Menu Accelerator Functions

Command: accelerate-menu

Make the menubar immediately active and place the cursor on the left most entry in the top level menu. Menu items can be selected as usual.

Variable: menu-accelerator-enabled

Whether menu accelerator keys can cause the menubar to become active.

If menu-force or menu-fallback, then menu accelerator keys can be used to activate the top level menu. Once the menubar becomes active, the accelerator keys can be used regardless of the value of this variable.

menu-force is used to indicate that the menu accelerator key takes precedence over bindings in the current keymap(s). menu-fallback means that bindings in the current keymap take precedence over menu accelerator keys. Thus a top level menu with an accelerator of "T" would be activated on a keypress of Meta-t if menu-accelerator-enabled is menu-force. However, if menu-accelerator-enabled is menu-fallback, then Meta-t will not activate the menubar and will instead run the function transpose-words, to which it is normally bound.

The default value is nil.

See also menu-accelerator-modifiers and menu-accelerator-prefix.

Variable: menu-accelerator-map

Keymap consulted to determine the commands to run in response to keypresses occurring while the menubar is active. See Keyboard Menu Traversal.

Variable: menu-accelerator-modifiers

A list of modifier keys which must be pressed in addition to a valid menu accelerator in order for the top level menu to be activated in response to a keystroke. The default value of (meta) mirrors the usage of the alt key as a menu accelerator in popular PC operating systems.

The modifier keys in menu-accelerator-modifiers must match exactly the modifiers present in the keypress. The only exception is that the shift modifier is accepted in conjunction with alphabetic keys even if it is not a menu accelerator modifier.

See also menu-accelerator-enabled and menu-accelerator-prefix.

Variable: menu-accelerator-prefix

Prefix key(s) that must be typed before menu accelerators will be activated. Must be a valid key descriptor.

The default value is nil.

(setq menu-accelerator-prefix ?\C-x)
(setq menu-accelerator-modifiers '(meta control))
(setq menu-accelerator-enabled 'menu-force)
(add-submenu nil '("%_Test"
                   ["One" (insert "1") :accelerator ?1 :active t]
                   ["%_Two" (insert "2")]
                   ["%_3" (insert "3")]))

will add the menu "Test" to the top level menubar. Pressing C-x followed by C-M-T will activate the menubar and display the "Test" menu. Pressing C-M-T by itself will not activate the menubar. Neither will pressing C-x followed by anything else.


Previous: , Up: Menu Accelerators   [Contents][Index]