From: Philipp Stephani <p.stephani2@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 24706@debbugs.gnu.org
Subject: bug#24706: 26.0.50; Minor mode functions should do strict argument type checking
Date: Sat, 1 Aug 2020 22:47:03 +0200 [thread overview]
Message-ID: <CAArVCkS3baVsd-4zBU9cQ=xYJ6A=nz6g3-M_pk=aJU_TPMf4PQ@mail.gmail.com> (raw)
In-Reply-To: <83tw5bo1em.fsf@gnu.org>
Am Mi., 26. Apr. 2017 um 13:27 Uhr schrieb Eli Zaretskii <eliz@gnu.org>:
>
> > From: Philipp Stephani <p.stephani2@gmail.com>
> > Date: Sun, 23 Apr 2017 17:51:32 +0000
> > Cc: drew.adams@oracle.com, 24706@debbugs.gnu.org
> >
> > Eli Zaretskii <eliz@gnu.org> schrieb am So., 16. Okt. 2016 um 20:51 Uhr:
> >
> > > From: Philipp Stephani <p.stephani2@gmail.com>
> > > 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.)
next prev parent reply other threads:[~2020-08-01 20:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-16 15:45 bug#24706: 26.0.50; Minor mode functions should do strict argument type checking Philipp Stephani
2016-10-16 16:12 ` Drew Adams
2016-10-16 16:31 ` Noam Postavsky
2016-10-16 16:49 ` Drew Adams
2016-10-16 18:01 ` Eli Zaretskii
2016-10-16 18:13 ` Philipp Stephani
2016-10-16 18:25 ` Philipp Stephani
2016-10-16 18:51 ` Eli Zaretskii
2017-04-23 17:51 ` Philipp Stephani
2017-04-26 11:26 ` Eli Zaretskii
2020-08-01 20:47 ` Philipp Stephani [this message]
2020-08-02 16:13 ` Eli Zaretskii
2020-10-01 12:12 ` Stefan Kangas
2016-10-16 18:53 ` Eli Zaretskii
2016-10-16 19:50 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAArVCkS3baVsd-4zBU9cQ=xYJ6A=nz6g3-M_pk=aJU_TPMf4PQ@mail.gmail.com' \
--to=p.stephani2@gmail.com \
--cc=24706@debbugs.gnu.org \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).