From unknown Sat Sep 06 13:38:08 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6335: 24.0.50; doc for define-minor-mode: specify ARG Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 02 Jun 2010 22:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 6335 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 6335@debbugs.gnu.org X-Debbugs-Original-To: Received: via spool by submit@debbugs.gnu.org id=B.127551647725148 (code B ref -1); Wed, 02 Jun 2010 22:08:02 +0000 Received: (at submit) by debbugs.gnu.org; 2 Jun 2010 22:07:57 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJw6P-0006XZ-1K for submit@debbugs.gnu.org; Wed, 02 Jun 2010 18:07:57 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJw6M-0006XT-R1 for submit@debbugs.gnu.org; Wed, 02 Jun 2010 18:07:55 -0400 Received: from lists.gnu.org ([199.232.76.165]:60930) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OJw6I-00045I-Rr for submit@debbugs.gnu.org; Wed, 02 Jun 2010 18:07:50 -0400 Received: from [140.186.70.92] (port=33597 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJw6H-00078h-3V for bug-gnu-emacs@gnu.org; Wed, 02 Jun 2010 18:07:50 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJw6F-0001vP-OK for bug-gnu-emacs@gnu.org; Wed, 02 Jun 2010 18:07:49 -0400 Received: from rcsinet10.oracle.com ([148.87.113.121]:30796) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJw6F-0001vG-Gt for bug-gnu-emacs@gnu.org; Wed, 02 Jun 2010 18:07:47 -0400 Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o52M7idp018645 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 2 Jun 2010 22:07:45 GMT Received: from acsmt354.oracle.com (acsmt354.oracle.com [141.146.40.154]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o52J0mel000742 for ; Wed, 2 Jun 2010 22:07:42 GMT Received: from abhmt007.oracle.com by acsmt355.oracle.com with ESMTP id 291755851275516445; Wed, 02 Jun 2010 15:07:25 -0700 Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 02 Jun 2010 15:07:24 -0700 From: "Drew Adams" Date: Wed, 2 Jun 2010 15:07:28 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 Thread-Index: AcsCn/0hqB6gArOdSna1XKWPxSg8vg== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 X-Auth-Type: Internal IP X-Source-IP: acsinet15.oracle.com [141.146.126.227] X-CT-RefId: str=0001.0A090202.4C06D632.00A4:SCFMA922111,ss=1,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -6.2 (------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.2 (------) (elisp) Minor Mode Conventions says this about a minor-mode command: The command should accept one optional argument. If the argument is `nil', it should toggle the mode (turn it on if it is off, and off if it is on). It should turn the mode on if the argument is a positive integer, the symbol `t', or a list whose CAR is one of those. It should turn the mode off if the argument is a negative integer or zero, the symbol `-', or a list whose CAR is a negative integer or zero. The meaning of other arguments is not specified. `define-minor-mode' defines such a command. But the doc for `define-minor-mode' does not let you know the identity of the parameter (which is ARG) or anything about where its value comes from interactively. It should, for at least these reasons: 1. A programmer can use the value. It is one thing to know that a positive arg turns the mode on. It is another thing to know what the arg name is, so that the command body can recuperate that value and use it. For example, the body of the command could do something different, depending on the value: (cond ((integer arg) (if (> arg 0) do-foo do-fa)) ((consp arg) ...) (arg ...) (t ...)) 2. This would require Emacs developers to maintain `define-minor-mode' so that the name ARG is respected. Yes, that's a good thing, not a bad thing. The argument should explicitly be part of the spec defining `define-minor-mode'. Programmers will anyway use `symbol-function' to find out what the parameter is, and it is better that Emacs Dev recognize this, respect the parameter name, and document it. The doc should also state clearly that the _raw prefix argument_ is used as ARG interactively. Programmers can then take advantage of that fact also. Knowing this, they can easily define a minor-mode command that lets users pass a significant value via a prefix arg. All of this is important, missing info for programmers. In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600) of 2010-05-23 on G41R2F1 Windowing system distributor `Microsoft Corp.', version 5.1.2600 configured using `configure --with-gcc (3.4) --no-opt --cflags -Ic:/xpm/include' From unknown Sat Sep 06 13:38:08 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: "Drew Adams" Subject: bug#6335: closed (Re: bug#6335: 24.0.50; doc for define-minor-mode: specify ARG) Message-ID: References: X-Gnu-PR-Message: they-closed 6335 X-Gnu-PR-Package: emacs Reply-To: 6335@debbugs.gnu.org Date: Thu, 03 Jun 2010 05:14:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1275542042-3638-1" This is a multi-part message in MIME format... ------------=_1275542042-3638-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #6335: 24.0.50; doc for define-minor-mode: specify ARG which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 6335@debbugs.gnu.org. --=20 6335: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D6335 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1275542042-3638-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 6335-done) by debbugs.gnu.org; 3 Jun 2010 05:13:38 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OK2kL-0000wS-8t for submit@debbugs.gnu.org; Thu, 03 Jun 2010 01:13:38 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.183] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJzdv-00088G-D0 for 6335-done@debbugs.gnu.org; Wed, 02 Jun 2010 21:54:47 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAI6oBkxFpYiT/2dsb2JhbACeI3LAFoUWBIxW X-IronPort-AV: E=Sophos;i="4.53,350,1272859200"; d="scan'208";a="67127296" Received: from 69-165-136-147.dsl.teksavvy.com (HELO pastel.home) ([69.165.136.147]) by ironport2-out.pppoe.ca with ESMTP; 02 Jun 2010 21:54:43 -0400 Received: by pastel.home (Postfix, from userid 20848) id 1F4E581F8; Wed, 2 Jun 2010 21:54:43 -0400 (EDT) From: Stefan Monnier To: "Drew Adams" Subject: Re: bug#6335: 24.0.50; doc for define-minor-mode: specify ARG Message-ID: References: Date: Wed, 02 Jun 2010 21:54:43 -0400 In-Reply-To: (Drew Adams's message of "Wed, 2 Jun 2010 15:07:28 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 6335-done X-Mailman-Approved-At: Thu, 03 Jun 2010 01:13:37 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) > (cond ((integer arg) (if (> arg 0) do-foo do-fa)) > ((consp arg) ...) > (arg ...) > (t ...)) I do not want to support this. > The doc should also state clearly that the _raw prefix argument_ is used > as ARG interactively. It's not the case. > Programmers can then take advantage of that fact also. Knowing this, > they can easily define a minor-mode command that lets users pass > a significant value via a prefix arg. And I don't want to support this either. If people want to write functions that behave somewhat like minor modes but with slightly different calling conventions, they can do that just fine with `defun'. Stefan ------------=_1275542042-3638-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 2 Jun 2010 22:07:57 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJw6P-0006XZ-1K for submit@debbugs.gnu.org; Wed, 02 Jun 2010 18:07:57 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJw6M-0006XT-R1 for submit@debbugs.gnu.org; Wed, 02 Jun 2010 18:07:55 -0400 Received: from lists.gnu.org ([199.232.76.165]:60930) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OJw6I-00045I-Rr for submit@debbugs.gnu.org; Wed, 02 Jun 2010 18:07:50 -0400 Received: from [140.186.70.92] (port=33597 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJw6H-00078h-3V for bug-gnu-emacs@gnu.org; Wed, 02 Jun 2010 18:07:50 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJw6F-0001vP-OK for bug-gnu-emacs@gnu.org; Wed, 02 Jun 2010 18:07:49 -0400 Received: from rcsinet10.oracle.com ([148.87.113.121]:30796) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJw6F-0001vG-Gt for bug-gnu-emacs@gnu.org; Wed, 02 Jun 2010 18:07:47 -0400 Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o52M7idp018645 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 2 Jun 2010 22:07:45 GMT Received: from acsmt354.oracle.com (acsmt354.oracle.com [141.146.40.154]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o52J0mel000742 for ; Wed, 2 Jun 2010 22:07:42 GMT Received: from abhmt007.oracle.com by acsmt355.oracle.com with ESMTP id 291755851275516445; Wed, 02 Jun 2010 15:07:25 -0700 Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 02 Jun 2010 15:07:24 -0700 From: "Drew Adams" To: Subject: 24.0.50; doc for define-minor-mode: specify ARG Date: Wed, 2 Jun 2010 15:07:28 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 Thread-Index: AcsCn/0hqB6gArOdSna1XKWPxSg8vg== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 X-Auth-Type: Internal IP X-Source-IP: acsinet15.oracle.com [141.146.126.227] X-CT-RefId: str=0001.0A090202.4C06D632.00A4:SCFMA922111,ss=1,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -6.2 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.2 (------) (elisp) Minor Mode Conventions says this about a minor-mode command: The command should accept one optional argument. If the argument is `nil', it should toggle the mode (turn it on if it is off, and off if it is on). It should turn the mode on if the argument is a positive integer, the symbol `t', or a list whose CAR is one of those. It should turn the mode off if the argument is a negative integer or zero, the symbol `-', or a list whose CAR is a negative integer or zero. The meaning of other arguments is not specified. `define-minor-mode' defines such a command. But the doc for `define-minor-mode' does not let you know the identity of the parameter (which is ARG) or anything about where its value comes from interactively. It should, for at least these reasons: 1. A programmer can use the value. It is one thing to know that a positive arg turns the mode on. It is another thing to know what the arg name is, so that the command body can recuperate that value and use it. For example, the body of the command could do something different, depending on the value: (cond ((integer arg) (if (> arg 0) do-foo do-fa)) ((consp arg) ...) (arg ...) (t ...)) 2. This would require Emacs developers to maintain `define-minor-mode' so that the name ARG is respected. Yes, that's a good thing, not a bad thing. The argument should explicitly be part of the spec defining `define-minor-mode'. Programmers will anyway use `symbol-function' to find out what the parameter is, and it is better that Emacs Dev recognize this, respect the parameter name, and document it. The doc should also state clearly that the _raw prefix argument_ is used as ARG interactively. Programmers can then take advantage of that fact also. Knowing this, they can easily define a minor-mode command that lets users pass a significant value via a prefix arg. All of this is important, missing info for programmers. In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600) of 2010-05-23 on G41R2F1 Windowing system distributor `Microsoft Corp.', version 5.1.2600 configured using `configure --with-gcc (3.4) --no-opt --cflags -Ic:/xpm/include' ------------=_1275542042-3638-1--