From f314ac2a30a475a2c578df8816adc9a2155dc259 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 26 Oct 2020 20:44:15 +0100 Subject: [PATCH] Make the -modes variable autoloaded * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Make the -modes variable be autoloaded. --- lisp/emacs-lisp/easy-mmode.el | 38 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index fe85667545d..a707d204f8b 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -486,6 +486,24 @@ this minor mode is used in." (when ,mode (,mode -1))))) ,@body) + ,(when predicate + `(defcustom ,MODE-predicate ,(car predicate) + ,(format "Which major modes `%s' is switched on in. +This variable can be either t (all major modes), nil (no major modes), +or a list of modes and (not modes) to switch use this minor mode or +not. For instance + + (c-mode (not message-mode mail-mode) text-mode) + +means \"use this mode in all modes derived from `c-mode', don't use in +modes derived from `message-mode' or `mail-mode', but do use in other +modes derived from `text-mode'\". An element with value t means \"use\" +and nil means \"don't use\". There's an implicit nil at the end of the +list." + mode) + :type '(repeat sexp) + :group ,group)) + ;; Autoloading define-globalized-minor-mode autoloads everything ;; up-to-here. :autoload-end @@ -533,25 +551,7 @@ this minor mode is used in." (defun ,MODE-cmhh () (add-to-list ',MODE-buffers (current-buffer)) (add-hook 'post-command-hook ',MODE-check-buffers)) - (put ',MODE-cmhh 'definition-name ',global-mode) - - ,(when predicate - `(defcustom ,MODE-predicate ,(car predicate) - ,(format "Which major modes `%s' is switched on in. -This variable can be either t (all major modes), nil (no major modes), -or a list of modes and (not modes) to switch use this minor mode or -not. For instance - - (c-mode (not message-mode mail-mode) text-mode) - -means \"use this mode in all modes derived from `c-mode', don't use in -modes derived from `message-mode' or `mail-mode', but do use in other -modes derived from `text-mode'\". An element with value t means \"use\" -and nil means \"don't use\". There's an implicit nil at the end of the -list." - mode) - :type '(repeat sexp) - :group ,group))))) + (put ',MODE-cmhh 'definition-name ',global-mode)))) (defun easy-mmode--globalized-predicate-p (predicate) (cond -- 2.39.2