unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 70589@debbugs.gnu.org, monnier@iro.umontreal.ca
Subject: bug#70589: [PATCH] Refine the Custom type of generated '*-modes' options
Date: Fri, 26 Apr 2024 14:24:42 +0200	[thread overview]
Message-ID: <m134r8gvlh.fsf@dazzs-mbp.kpn> (raw)
In-Reply-To: <865xw4z7bn.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 26 Apr 2024 14:34:04 +0300")

[-- Attachment #1: Type: text/plain, Size: 1015 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Eshel Yaron <me@eshelyaron.com>
>> Cc: 70589@debbugs.gnu.org,  Stefan Monnier <monnier@iro.umontreal.ca>
>> Date: Fri, 26 Apr 2024 13:13:37 +0200
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> > Why does it make sense to have the "all" and "none" alternatives
>> > twice?
>> 
>> These are slightly different: a value of t ("Enable in all major modes")
>> says to enable everywhere, while a t inside a list ("All major modes")
>> says to enable in modes that were not mentioned earlier in the list (so
>> putting t in the end of the list means "otherwise, enable").  Similarly
>> for the "none" alternatives: a value of nil ("Don't enable...") means we
>> never enable the minor mode, while the effect of a nil inside the list
>> is relative to the previous elements, and means "otherwise, don't".
>> Does that make sense?
>
> It might make sense, if we change the labels to say what you tell
> above.
>
> Thanks.

OK, here's an updated patch with revised labels:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v2-0001-Refine-the-Custom-type-of-generated-modes-options.patch --]
[-- Type: text/x-patch, Size: 1947 bytes --]

From 88ad06894cba8cfaf7b7c1916449f9f10e1cb6e7 Mon Sep 17 00:00:00 2001
From: Eshel Yaron <me@eshelyaron.com>
Date: Fri, 26 Apr 2024 11:43:29 +0200
Subject: [PATCH v2] Refine the Custom type of generated '*-modes' options

* 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 | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index eaad9646985..081619002c8 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -580,7 +580,19 @@ define-globalized-minor-mode
 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
-- 
2.44.0


  reply	other threads:[~2024-04-26 12:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26  9:49 bug#70589: [PATCH] Refine the Custom type of generated '*-modes' options Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-26 10:56 ` Eli Zaretskii
2024-04-27  6:59   ` Eli Zaretskii
2024-04-27 14:33     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-27 15:35       ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-27 15:47         ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-27 21:03           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-28 19:07             ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-26 10:58 ` Eli Zaretskii
2024-04-26 11:13   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-26 11:34     ` Eli Zaretskii
2024-04-26 12:24       ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-04-26 15:00         ` Eli Zaretskii
2024-04-26 16:34           ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-26 17:15             ` Eli Zaretskii
2024-04-26 17:55               ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-26 18:29                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m134r8gvlh.fsf@dazzs-mbp.kpn \
    --to=bug-gnu-emacs@gnu.org \
    --cc=70589@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=me@eshelyaron.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).