bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#44341: 27.1; define-minor-mode generates inaccurate docstring


From: Lars Ingebrigtsen
Subject: bug#44341: 27.1; define-minor-mode generates inaccurate docstring
Date: Sun, 01 Nov 2020 15:00:50 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]