From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#70589: [PATCH] Refine the Custom type of generated '*-modes' options Date: Fri, 26 Apr 2024 14:24:42 +0200 Message-ID: References: <86frv8z8zc.fsf@gnu.org> <865xw4z7bn.fsf@gnu.org> Reply-To: Eshel Yaron Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7200"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 70589@debbugs.gnu.org, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 26 14:26:18 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s0Kef-0001XI-4Y for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 26 Apr 2024 14:26:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s0KeL-0002Rj-3z; Fri, 26 Apr 2024 08:25:57 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s0KeH-0002RO-Gs for bug-gnu-emacs@gnu.org; Fri, 26 Apr 2024 08:25:54 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s0KeH-0005e6-7k for bug-gnu-emacs@gnu.org; Fri, 26 Apr 2024 08:25:53 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s0KeY-0007Ep-RL for bug-gnu-emacs@gnu.org; Fri, 26 Apr 2024 08:26:10 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eshel Yaron Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 26 Apr 2024 12:26:10 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70589 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70589-submit@debbugs.gnu.org id=B70589.171413431627176 (code B ref 70589); Fri, 26 Apr 2024 12:26:10 +0000 Original-Received: (at 70589) by debbugs.gnu.org; 26 Apr 2024 12:25:16 +0000 Original-Received: from localhost ([127.0.0.1]:34270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s0Kdb-00073a-FD for submit@debbugs.gnu.org; Fri, 26 Apr 2024 08:25:15 -0400 Original-Received: from mail.eshelyaron.com ([107.175.124.16]:48806 helo=eshelyaron.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s0KdT-00071g-AG for 70589@debbugs.gnu.org; Fri, 26 Apr 2024 08:25:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1714134284; bh=2UziZCSKRflv89IgJR+eN1RpCKnqOG/7Ihr02oALcPI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=kxEX0/mgKGCkBiiHpc8WTtWeRH1r2PB4SFr7Otn9iBRCDZxX2x8yuaNlM1+ZldO7y ttGT9r76Lphk17ZzUhdDX1pjRn1Txwu2WOUBpjy1paXTinaJmY0kY8n15+8DUfXde9 QTWan43SQvumz3evEwJJDXuYQBl+XhZcKU2a7gqGwCn3Q59uWgyHYyzAzueVQkhPI3 nuW8JgNg+wnaFwx8FZ7b4S6u4fVlqdd2f5gas0SqCjX5wmfV2A6dG+Kw3ogNaO8QJW RoSXTVqjeM9OxEbEmR6nfe582aP1vUncAe2Q0m/5LCmfhupiqb6DHNYClxxbqnLEoz 7AJ4UF45PeBlA== In-Reply-To: <865xw4z7bn.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 26 Apr 2024 14:34:04 +0300") X-Hashcash: 1:20:240426:eliz@gnu.org::qfLJXtt9w4v1CuQD:2KrG X-Hashcash: 1:20:240426:70589@debbugs.gnu.org::o9LGtgZg/DPSoDdG:0UVS X-Hashcash: 1:20:240426:monnier@iro.umontreal.ca::lD83i67OzJILhWhU:2EaR X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:283987 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Eshel Yaron >> Cc: 70589@debbugs.gnu.org, Stefan Monnier >> Date: Fri, 26 Apr 2024 13:13:37 +0200 >> >> Eli Zaretskii 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: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=v2-0001-Refine-the-Custom-type-of-generated-modes-options.patch >From 88ad06894cba8cfaf7b7c1916449f9f10e1cb6e7 Mon Sep 17 00:00:00 2001 From: Eshel Yaron 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 --=-=-=--