From bcd02cf5127ecfe6d6ce4ac316f881246c49db4f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii <eliz@gnu.org> Date: Thu, 23 Mar 2023 11:30:19 +0200 Subject: ; 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. --- lisp/emacs-lisp/easy-mmode.el | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index e84207da2df..0f6711209a5 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -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 -- cgit v1.2.3