From b3f11e94fad97144c4bd01c0d6e729d27bc7bfc7 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 18 Jun 2023 08:50:54 +0300 Subject: [PATCH] Fix documentation of :predicate in 'define-globalized-minor-mode' * doc/lispref/modes.texi (Defining Minor Modes): * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Document that :predicate creates a customizable user option. (Bug#64048) --- doc/lispref/modes.texi | 13 ++++++++----- lisp/emacs-lisp/easy-mmode.el | 7 +++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 3eb61b4d565..4a54d6ec290 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -1888,11 +1888,14 @@ user option called the same as the global mode variable, but with @code{-modes} instead of @code{-mode} at the end, i.e.@: @code{@var{global-mode}s}. This variable will be used in a predicate function that determines whether the minor mode should be activated in -a particular major mode. Valid values of @code{:predicate} include -@code{t} (use in all major modes), @code{nil} (don't use in any major -modes), or a list of mode names, optionally preceded with @code{not} -(as in @w{@code{(not @var{mode-name} @dots{})}}). These elements can -be mixed, as shown in the following examples. +a particular major mode, and users can customize the value of the +variable to control the modes in which the minor mode will be switched +on. Valid values of @code{:predicate} (and thus valid values of the +user option it creates) include @code{t} (use in all major modes), +@code{nil} (don't use in any major modes), or a list of mode names, +optionally preceded with @code{not} (as in @w{@code{(not +@var{mode-name} @dots{})}}). These elements can be mixed, as shown in +the following examples. @example (c-mode (not mail-mode message-mode) text-mode) diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index 22ea12f0960..98c211325ab 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -450,14 +450,17 @@ 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. -The :predicate argument specifies in which major modes should the +The :predicate key 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. +details. The :predicate key causes the macro to create a user option +named the same as MODE, but ending with \"-modes\" instead of \"-mode\". +That user option can then be used to customize in which modes this +globalized minor mode will be switched on. 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', -- 2.39.2