unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
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 15:00:50 +0100	[thread overview]
Message-ID: <87sg9tb2i5.fsf@gnus.org> (raw)
In-Reply-To: <87361u64oo.fsf@thb.lt> (Thibault Polge's message of "Sat, 31 Oct 2020 12:00:23 +0100")

Thibault Polge <thibault@thb.lt> writes:

>> If called from Lisp, also enable the mode if ARG is omitted or nil,
>> and toggle it if ARG is ‘toggle’; disable the mode otherwise.
>
> This case (non-interactively, enable the mode if ARG is non-nil, unless
> it's toggle) doesn't seem to have been implemented.  Here's a test that
> demonstrates that:
>
> (mapcar
>   (lambda (x) (test-mode x) (cons x test-mode))
>   '(t ; Should disable.
>     nil ; Should disable
>     -33 ; Should NOT disable (but will)
>     33 ; Should enable
>     0 ; Should disable
>     toggle ; Should toggle, and will.
>     toggle ; Repeated for confirmation
>     disable ; Should disable (as a random symbol)
>     disable ; Again
>     "What?" ; Same.
>     ))

I think there's bugs here both in the doc string and in the
implementation: A negative number should switch the mode off, so the
code works correctly there (but not according to documentation).

Is this a typo?

>     nil ; Should disable

because nil should enable (as documented), and does.

The other values that enables (but should disable) you note are
correct.  I mean, it's correct that the current implementation is
incorrect, and I've now pushed a fixed for this to the trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2020-11-01 14:00 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 [this message]
2020-11-01 15:29 ` Stefan Monnier
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=87sg9tb2i5.fsf@gnus.org \
    --to=larsi@gnus.org \
    --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).