unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Thibault Polge <thibault@thb.lt>
Cc: 44341@debbugs.gnu.org
Subject: bug#44341: 27.1; define-minor-mode generates inaccurate docstring
Date: Sun, 01 Nov 2020 10:29:27 -0500	[thread overview]
Message-ID: <jwvimap2jb8.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87361u64oo.fsf@thb.lt> (Thibault Polge's message of "Sat, 31 Oct 2020 12:00:23 +0100")

> (mapcar
>   (lambda (x) (test-mode x) (cons x test-mode))
>   '(t ; Should disable.

An argument of the form t has traditionally enabled the mode.
Many .emacs file have calls like (foo-mode t), so we need to preserve this.

>     nil ; Should disable

The argument nil should definitely enable the mode.

>     -33 ; Should NOT disable (but will)
>     33 ; Should enable

Negative and positive are the "canonical" way to disable and enable
a mode, no -33 should disable and 33 should enable.

>     0 ; Should disable

Historically, 0 has been defined to disable the mode, indeed.
I recommend to use -1 instead, but a lot of code uses 0.

>     toggle ; Should toggle, and will.
>     toggle ; Repeated for confirmation

Right.

>     disable ; Should disable (as a random symbol)
>     disable ; Again
>     "What?" ; Same.

These should be considered as errors.  Whether we catch them and signal
an error or silently do something else is not particular important
to me.  But we shouldn't document the behavior for those arguments as
being anything else than errors.


        Stefan






  parent reply	other threads:[~2020-11-01 15:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-31 11:00 bug#44341: 27.1; define-minor-mode generates inaccurate docstring Thibault Polge
2020-11-01 14:00 ` Lars Ingebrigtsen
2020-11-01 15:29 ` Stefan Monnier [this message]
2020-11-02 12:28   ` Philipp Stephani
2020-11-02 15:35     ` Lars Ingebrigtsen
2020-11-02 15:52     ` Eli Zaretskii
2020-11-02 16:18     ` 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=jwvimap2jb8.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=44341@debbugs.gnu.org \
    --cc=thibault@thb.lt \
    /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).