]> git.eshelyaron.com Git - emacs.git/commitdiff
Refine the Custom type of generated '*-modes' options
authorEshel Yaron <me@eshelyaron.com>
Fri, 26 Apr 2024 09:43:29 +0000 (11:43 +0200)
committerEshel Yaron <me@eshelyaron.com>
Fri, 26 Apr 2024 12:20:34 +0000 (14:20 +0200)
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode):
Refine the Custom type of the '*-modes' option, generated when
this macro is given a ':predicate' argument.  (Bug#70589)

lisp/emacs-lisp/easy-mmode.el

index eaad96469854c2cde6b702eb6758ec32518f1cb2..081619002c8d2db2eed5720e645cab8ade955ed0 100644 (file)
@@ -580,7 +580,19 @@ 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)
+             :type '(choice (const :tag "Enable in all major modes" t)
+                            (const :tag "Don't enable in any major mode" nil)
+                            (repeat :tag "Rules (earlier takes precedence)..."
+                                    (choice
+                                     (const :tag "By default, enable" t)
+                                     (const :tag "By default, don't enable" nil)
+                                     (symbol :value fundamental-mode
+                                             :tag "Enable in major mode")
+                                     (cons :tag "Don't enable in major modes"
+                                           (const :tag "Don't enable in..." not)
+                                           (repeat
+                                            (symbol :value fundamental-mode
+                                                    :tag "Major mode"))))))
              ,@group))
 
        ;; Autoloading define-globalized-minor-mode autoloads everything