(lispref.info)Menu Hooks


Next: Buffers Menu Prev: Pop-Up Menus Up: Menus

Menu Hooks
==========

 - Variable: menu-no-selection-hook
     This is a normal hook that will be called when a menu or dialog
     box is dismissed without a selection having been made.

 - Variable: activate-menubar-hook
     This is a function or list of functions that is called before a
     menubar menu is pulled down.  The functions in the hook should
     interrogate and modify the value of `current-menubar' as desired.

     The functions on this hook are invoked after the mouse goes down,
     but before the menu is mapped, and may be used to activate,
     deactivate, add, or delete items from the menus.

     These functions may return the symbol `t' to assert that they have
     made no changes to the menubar.  If any other value is returned,
     the menubar is recomputed.  If `t' is returned but the menubar has
     been changed, then the changes may not show up right away.
     Returning `nil' when the menubar has not changed is not so bad;
     more computation will be done, but redisplay of the menubar will
     still be performed optimally.

   The following two functions are provided for use in
`activate-menubar-hook' and are automatically added to the hook at
startup time.

 - Function: sensitize-file-and-edit-menus-hook
     This function changes the sensitivity of these `File' and `Edit'
     menu items:

    `Cut'
          Sensitive only when Emacs owns the primary X Selection (if
          `zmacs-regions' is `t', this is equivalent to saying that
          there is a region selected).

    `Copy'
          Sensitive only when Emacs owns the primary X Selection.

    `Clear'
          Sensitive only when Emacs owns the primary X Selection.

    `Paste'
          Sensitive only when there is an owner for the X Clipboard
          Selection.

    `Undo'
          Sensitive only when there is undo information.  While in the
          midst of an undo, this is changed to `Undo More'.

    `Kill Buffer'
          Has the name of the current buffer appended to it.

    `Print Buffer'
          Has the name of the current buffer appended to it.

    `Save Buffer'
          Has the name of the current buffer appended to it, and is
          sensitive only when the current buffer is modified.

    `Revert Buffer'
          Has the name of the current buffer appended to it, and is
          sensitive only when the current buffer has a file.

    `Delete Screen'
          Sensitive only when there is more than one visible screen.

 - Function: build-buffers-menu-hook
     This function changes the contents of the `Buffers' menu to
     correspond to the current set of buffers.  Only the
     most-recently-used few buffers will be listed on the menu, for
     efficiency reasons.  Note: Buffers Menu, for options controlling
     how the `Buffers' menu will be displayed.


automatically generated by info2www