1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

; Improve documentation of :predicate in globalized minor modes

* doc/lispref/modes.texi (Defining Minor Modes):
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Improve documentation of the :predicate keyword in defining
globalized minor modes.
This commit is contained in:
Eli Zaretskii 2023-03-23 11:30:19 +02:00
parent 930b9fdd3a
commit bcd02cf512
2 changed files with 39 additions and 23 deletions

View file

@ -449,15 +449,23 @@ No problems result if this variable is not bound.
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.
Each of KEY VALUE is a pair of CL-style keyword arguments.
The :predicate argument specifies in which major modes should the
globalized minor mode be switched on. The value should be t (meaning
switch on the minor mode in all major modes), nil (meaning don't
switch on in any major mode), a list of modes (meaning switch on only
in those modes and their descendants), or a list (not MODES...),
meaning switch on in any major mode except MODES. The value can also
mix all of these forms, see the info node `Defining Minor Modes' for
details.
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