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 13:13:37 +0200 Message-ID: References: <86frv8z8zc.fsf@gnu.org> Reply-To: Eshel Yaron Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="814"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 70589@debbugs.gnu.org, Stefan Monnier To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 26 13:15:03 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 1s0JXi-000AXf-GO for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 26 Apr 2024 13:15:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s0JXV-0003hb-Rk; Fri, 26 Apr 2024 07:14:49 -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 1s0JXS-0003hJ-Fr for bug-gnu-emacs@gnu.org; Fri, 26 Apr 2024 07:14:46 -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 1s0JXS-0003hb-6B for bug-gnu-emacs@gnu.org; Fri, 26 Apr 2024 07:14:46 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s0JXk-000880-Ew for bug-gnu-emacs@gnu.org; Fri, 26 Apr 2024 07:15:04 -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 11:15:04 +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.171413005830699 (code B ref 70589); Fri, 26 Apr 2024 11:15:04 +0000 Original-Received: (at 70589) by debbugs.gnu.org; 26 Apr 2024 11:14:18 +0000 Original-Received: from localhost ([127.0.0.1]:34096 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s0JWy-0007yk-T9 for submit@debbugs.gnu.org; Fri, 26 Apr 2024 07:14:18 -0400 Original-Received: from mail.eshelyaron.com ([107.175.124.16]:35080 helo=eshelyaron.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s0JWh-0007v9-2Y for 70589@debbugs.gnu.org; Fri, 26 Apr 2024 07:14:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1714130020; bh=B/l38vMeVfZJtqAKiCNS4Y3U+tOQy/EF5PlwPBVibwY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=vVho7ZWZvndcxco8RNHPNtEjC0hYnx4RHYfehbixQMmflhWLQF78gSOPJcelX0uz2 TNArS/MW7C4PYX4if/DIO2iM5tF/YamddbudtYzUxS8dsfXf5vM6qW9HDA7a7pyeoC i/GysjdpqL6IoEXPQLJmc8cx8CnnDqPWC1+qArj7ZDd8PuT92xnAgvh1rRkznD9vGK Y7Abirdds3veyVnpLnOssRh/+ZFyawNPC+F0Tho5P3OVLdW1gWEsPdOqCcrb2f2Zc1 Mz5irhPJPCfbc3on+N+1BX+78JFrYicmZZja5zFjQcX9LG6PVzrvjAUF1knDNwpALx WrSaotwD7N2RQ== In-Reply-To: <86frv8z8zc.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 26 Apr 2024 13:58:15 +0300") 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:283983 Archived-At: Hi, Eli Zaretskii writes: >> Date: Fri, 26 Apr 2024 11:49:19 +0200 >> From: Eshel Yaron via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" >> >> --- 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 "Only enable in" >> + (choice >> + (const :tag "All major modes" t) >> + (const :tag "No major mode" nil) >> + (symbol :value fundamental-mode >> + :tag "Specific major mode") >> + (cons :tag "Exclude modes" >> + (const :tag "Exclude..." not) >> + (repeat >> + (symbol :value fundamental-mode >> + :tag "Major mode")))))) > > 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?