Function: define-global-minor-mode
define-global-minor-mode is a for
define-globalized-minor-mode, defined in easy-mmode.el.gz.
Signature
(define-global-minor-mode GLOBAL-MODE MODE TURN-ON [KEY VALUE]... BODY...)
Documentation
Make a global mode GLOBAL-MODE corresponding to buffer-local minor MODE.
TURN-ON is a function that will be called with no args in every buffer and that should try to turn MODE on if applicable for that buffer.
Each of KEY VALUE is a pair of CL-style keyword arguments. :predicate
specifies which major modes the globalized minor mode should be switched on
in. As the minor mode defined by this function is always global, any
:global keyword is ignored. Other keywords have the same meaning as in
define-minor-mode, which see. In particular, :group specifies the custom
group. The most useful keywords are those that are passed on to the
defcustom. It normally makes no sense to pass the :lighter or :keymap
keywords to define-globalized-minor-mode, since these are usually passed
to the buffer-local version of the minor mode.
BODY contains code to execute each time the mode is enabled or disabled. It is executed after toggling the mode, and before running GLOBAL-MODE-hook.
If MODE's set-up depends on the major mode in effect when it was enabled, then disabling and reenabling MODE should make MODE work correctly with the current major mode. This is important to prevent problems with derived modes, that is, major modes that call another major mode in their body.
When a major mode is initialized, MODE is actually turned on just after running the major mode's hook. However, MODE is not turned on if the hook has explicitly disabled it.