From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#24706: 26.0.50; Minor mode functions should do strict argument type checking Date: Wed, 26 Apr 2017 14:26:25 +0300 Message-ID: <83tw5bo1em.fsf@gnu.org> References: <83mvi4yvoj.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1493206104 31079 195.159.176.226 (26 Apr 2017 11:28:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 26 Apr 2017 11:28:24 +0000 (UTC) Cc: 24706@debbugs.gnu.org To: Philipp Stephani Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Apr 26 13:28:20 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d3L7M-00080m-NH for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Apr 2017 13:28:20 +0200 Original-Received: from localhost ([::1]:54386 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3L7S-0002e9-4N for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Apr 2017 07:28:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39560) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3L77-0002WD-Vv for bug-gnu-emacs@gnu.org; Wed, 26 Apr 2017 07:28:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3L74-00017d-RM for bug-gnu-emacs@gnu.org; Wed, 26 Apr 2017 07:28:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42433) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3L74-00017G-OS for bug-gnu-emacs@gnu.org; Wed, 26 Apr 2017 07:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d3L74-0007X9-GF for bug-gnu-emacs@gnu.org; Wed, 26 Apr 2017 07:28:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Apr 2017 11:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24706 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24706-submit@debbugs.gnu.org id=B24706.149320603528906 (code B ref 24706); Wed, 26 Apr 2017 11:28:02 +0000 Original-Received: (at 24706) by debbugs.gnu.org; 26 Apr 2017 11:27:15 +0000 Original-Received: from localhost ([127.0.0.1]:40632 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d3L6J-0007WA-0g for submit@debbugs.gnu.org; Wed, 26 Apr 2017 07:27:15 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:48200) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d3L6H-0007Vv-B8 for 24706@debbugs.gnu.org; Wed, 26 Apr 2017 07:27:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3L68-0000VN-Ta for 24706@debbugs.gnu.org; Wed, 26 Apr 2017 07:27:08 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53312) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3L68-0000VJ-R5; Wed, 26 Apr 2017 07:27:04 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3766 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1d3L68-0004X4-34; Wed, 26 Apr 2017 07:27:04 -0400 In-reply-to: (message from Philipp Stephani on Sun, 23 Apr 2017 17:51:32 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:132010 Archived-At: > From: Philipp Stephani > Date: Sun, 23 Apr 2017 17:51:32 +0000 > Cc: drew.adams@oracle.com, 24706@debbugs.gnu.org > > Eli Zaretskii schrieb am So., 16. Okt. 2016 um 20:51 Uhr: > > > From: Philipp Stephani > > Date: Sun, 16 Oct 2016 18:25:08 +0000 > > > > Attached a patch that uses the wording from `define-minor-mode'. > > The patch for the ELisp manual simply rearranges the same words, so > it's not clear to me why we would prefer it to what's already there. > > I don't think there's any repetition or rearranging here. Here's the ELisp manual part of your proposed change: If the mode command is called from Lisp (i.e., non-interactively), it -should enable the mode if the argument is omitted or @code{nil}; it -should toggle the mode if the argument is the symbol @code{toggle}; -otherwise it should treat the argument in the same way as for an -interactive call with a numeric prefix argument, as described above. +should toggle the mode if the argument is the symbol @code{toggle}; it +should disable the mode if the argument is a non-positive integer; +otherwise, e.g., if the argument is omitted or nil or a positive +integer, it should enable the mode. Don't you agree that it does little apart of re-shuffling the same words? > The key difference is that when called from Lisp with an > argument that is neither nil nor an integer, the mode is also enabled. Why would we want to require that? This subsection describes the conventions, it doesn't describe the effect of certain popular implementation of those conventions, because we don't really want to _require_ modes to behave in any way beyond the described behavior. > "With a prefix argument ARG, enable the mode if ARG is positive, and disable it if ARG is negative or zero. This is almost exactly the same as the current: With a prefix argument ARG, enable %s if ARG is positive, and disable it otherwise. > Additionally, when called from Lisp, toggle the mode if ARG is the symbol `toggle' and interpret ARG as > defined by `prefix-numeric-value' otherwise." And this is exactly what I suggested back then: > As for the doc string, please avoid repetition, it's confusing. I > suggested to describe the additional features when the mode is called > from Lisp by using the word "also". The wording I had in mind was similar to yours: When called from Lisp, also enable the mode if ARG is omitted or nil, and toggle it if ARG is `toggle'.