easy-mmode-define-minor-mode
easy-mmode-define-minor-mode is an alias for `
define-minor-mode' in `
easy-mmode.el
'.
(easy-mmode-define-minor-mode
MODE DOC &optional
INIT-VALUE LIGHTER KEYMAP &rest
BODY)
Define a new minor mode
MODE.
This defines the toggle command
MODE and (by default) a control variable
MODE (you can override this with the :variable keyword, see below).
DOC is the documentation for the mode toggle command.
The defined mode command takes one optional (prefix) argument.
Interactively with no prefix argument, it toggles the mode.
A prefix argument enables the mode if the argument is positive,
and disables it otherwise.
When called from Lisp, the mode command toggles the mode if the
argument is `toggle', disables the mode if the argument is a
non-positive integer, and enables the mode otherwise (including
if the argument is omitted or nil or a positive integer).
If
DOC is nil, give the mode command a basic doc-string
documenting what its argument does.
Optional
INIT-VALUE is the initial value of the mode's variable.
Optional
LIGHTER is displayed in the mode line when the mode is on.
Optional
KEYMAP is the default keymap bound to the mode keymap.
If non-nil, it should be a variable name (whose value is a keymap),
or an expression that returns either a keymap or a list of
arguments for `easy-mmode-define-keymap'. If you supply a
KEYMAP
argument that is not a symbol, this macro defines the variable
MODE-map and gives it the value that
KEYMAP specifies.
BODY contains code to execute each time the mode is enabled or disabled.
It is executed after toggling the mode, and before running
MODE-hook.
Before the actual body code, you can write keyword arguments, i.e.
alternating keywords and values. These following special keywords
are supported (other keywords are passed to `defcustom' if the minor
mode is global):
:group GROUP Custom group name to use in all generated `defcustom' forms.
Defaults to
MODE without the possible trailing "-mode".
Don't use this default group name unless you have written a
`defgroup' to define that group properly.
:global GLOBAL If non-nil specifies that the minor mode is not meant to be
buffer-local, so don't make the variable
MODE buffer-local.
By default, the mode is buffer-local.
:init-value VAL Same as the
INIT-VALUE argument.
Not used if you also specify :variable.
:lighter SPEC Same as the
LIGHTER argument.
:keymap MAP Same as the
KEYMAP argument.
:require SYM Same as in `defcustom'.
:variable PLACE The location to use instead of the variable
MODE to store
the state of the mode. This can be simply a different
named variable, or a generalized variable.
PLACE can also be of the form (GET . SET), where GET is
an expression that returns the current state, and SET is
a function that takes one argument, the new state, and
sets it. If you specify a :variable, this function does
not define a
MODE variable (nor any of the terms used
in :variable).
:after-hook A single lisp form which is evaluated after the mode hooks
have been run. It should not be quoted.
For example, you could write
(define-minor-mode foo-mode "If enabled, foo on you!"
:lighter " Foo" :require 'foo :global t :group 'hassle :version "27.5"
...
BODY CODE...)