From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#24706: 26.0.50; Minor mode functions should do strict argument type checking Date: Sat, 1 Aug 2020 22:47:03 +0200 Message-ID: References: <83mvi4yvoj.fsf@gnu.org> <83tw5bo1em.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6475"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 24706@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 01 22:48:13 2020 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 1k1yQM-0001Yt-KM for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 01 Aug 2020 22:48:10 +0200 Original-Received: from localhost ([::1]:48608 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k1yQL-0000DT-Ma for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 01 Aug 2020 16:48:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k1yQE-0000DD-SE for bug-gnu-emacs@gnu.org; Sat, 01 Aug 2020 16:48:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57843) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k1yQE-0007Ur-Iy for bug-gnu-emacs@gnu.org; Sat, 01 Aug 2020 16:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k1yQE-0003cH-Ft for bug-gnu-emacs@gnu.org; Sat, 01 Aug 2020 16:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Aug 2020 20:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24706 X-GNU-PR-Package: emacs Original-Received: via spool by 24706-submit@debbugs.gnu.org id=B24706.159631484213855 (code B ref 24706); Sat, 01 Aug 2020 20:48:02 +0000 Original-Received: (at 24706) by debbugs.gnu.org; 1 Aug 2020 20:47:22 +0000 Original-Received: from localhost ([127.0.0.1]:41156 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k1yPZ-0003bP-RJ for submit@debbugs.gnu.org; Sat, 01 Aug 2020 16:47:22 -0400 Original-Received: from mail-oi1-f173.google.com ([209.85.167.173]:44425) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k1yPY-0003bA-Et for 24706@debbugs.gnu.org; Sat, 01 Aug 2020 16:47:20 -0400 Original-Received: by mail-oi1-f173.google.com with SMTP id h3so6341648oie.11 for <24706@debbugs.gnu.org>; Sat, 01 Aug 2020 13:47:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XGPzx/aiQxIMndLfny+mp3UiGKvd2lP1/zXYxrWklz0=; b=Zscg/GcV9bAOqW8JIAKrqJhAWvHbXFHfXUGj0XWmsW5sdTzR7gPi1hzI1RCsZxDCX3 aY92NFYJf+PdQbvbcrijAELxZWPiJ6BSP3oT/8Y+mzZoxo0Vef4cLdDWA8vGcGprB57+ 5jPcuQ3sLE4dAOQ52bSdAv3dIP92ER5r2TXBeag+7juqjh8ODKLWxXB8iAL0yNKDIie8 L2nxLfRS358qqc22Co8b1t9/MBu2Vq+XU1xXuRXC7OcfZdIzzbQZ4G4y89c+4pk2rZTU 5adMdHfCr81wnT/LjXormKPCWdm4YhZ2DnrU1U9/06zcrsPjN9Bi6D94icEEJ0fC6u2D AXgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XGPzx/aiQxIMndLfny+mp3UiGKvd2lP1/zXYxrWklz0=; b=thMGlGBFuxJNVfKlfNPo0KdkWPUzPe5Qmyvco2uQEbs5uCeYSaN6Yk8hLbaH070DzD Bxil56tdPYNsnsgEY1qOocX6wvdiBG5vxMEew+DMuboNJVLeGbcTyFDRDITOkrkq55sZ RJIV57d4NUEiiWtBZeJNs7ZlDNDEcduyquTID9HuRTj+VEWE91uZ8rkMggLprjvMrB/G DC4bbQMj/CFR/Gt9zNtO9aO4BFgUtMvduU97AOgdXP5jKUZ5sFbWrB6JKBUcRNqt5ZLK j31sOmxvxXYc1Q3q8z5Td+2n+N9cS5pJsDOHh+QWlAYu3rUqUAYqBIOTi9aCtXwx3Sfb N/Tg== X-Gm-Message-State: AOAM532YNwdheKkraO/pYkOcd57xe2hwVxjUG73DP9Aew3/6p+XMhE3C 5maCPj8oj8X2Kvtk22qP4AjXT2VnrsAD3lKKvOQ= X-Google-Smtp-Source: ABdhPJxDQVSBAZrUnfigxVi3EHnTfxJLOfAULdWTpWzwwXDCYjVwT6/sERQQ+s19DAsJNYKI8yc/4Nf+6ISu3uExa8E= X-Received: by 2002:aca:b884:: with SMTP id i126mr7664286oif.65.1596314834577; Sat, 01 Aug 2020 13:47:14 -0700 (PDT) In-Reply-To: <83tw5bo1em.fsf@gnu.org> 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" Xref: news.gmane.io gmane.emacs.bugs:183798 Archived-At: Am Mi., 26. Apr. 2017 um 13:27 Uhr schrieb Eli Zaretskii : > > > 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? It also describes what happens when the argument is neither nil nor `toggle' nor an integer. That is currently unspecified, or rather implicitly specified by the observable (but unspecified) behavior of `prefix-numeric-value'. > > > 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. This isn't about the implementation but the interface, i.e. the observable behavior of minor mode functions. > > > "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'. That again doesn't describe what happens if neither of these cases apply. (My suggestion from 2017 also wouldn't work here as-is, because the behavior of `prefix-numeric-value' isn't defined for these cases either.)