all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Phil Sainty <psainty@orcon.net.nz>
To: dalanicolai@gmail.com
Cc: 49843@debbugs.gnu.org
Subject: bug#49843: 28.0.50; Error in docstring after using define-globalized-minor-mode
Date: Tue, 03 Aug 2021 21:18:18 +1200	[thread overview]
Message-ID: <cdba1a2a077c142cd83d7646a8d036bf@webmail.orcon.net.nz> (raw)
In-Reply-To: <70a6133fb48569d5bcc1a1bf191ce582@webmail.orcon.net.nz>

In fact I was looking in Emacs 27, and it's all changed in 28,
so apologies for my confusion.  We actually now have this template:

(defconst easy-mmode--arg-docstring
   "

This is a minor mode.  If called interactively, toggle the `%s'
mode.  If the prefix argument is positive, enable the mode, and
if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is `toggle'.
Enable the mode if ARG is nil, omitted, or is a positive number.
Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer,
evaluate `%S'.

The mode's hook is called both when the mode is enabled and when
it is disabled.")


That description still doesn't specify what happens with other
values, and I realise you're saying that the docstring of
`define-minor-mode' itself has a different, more comprehensive
explanation:

"When called from Lisp, the mode command toggles the mode if the
argument is `toggle', disables the mode if the argument is a
non-positive integer, and enables the mode otherwise (including
if the argument is omitted or nil or a positive integer)."

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44341 is related.

I notice the commit message for 5cea77af41b59ba6f6386264812c36ec31ba2efc
says:

     * lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring):
     Only document the values we want to support, not the ones we
     actually support.

So the failure to say what happens if you pass something other
than an integer or 'toggle seems intentional, as other kinds of
argument shouldn't ever be used.

I expect that globalized modes should also use the text of the
`easy-mmode--arg-docstring' template.







  reply	other threads:[~2021-08-03  9:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03  4:51 bug#49843: 28.0.50; Error in docstring after using define-globalized-minor-mode dalanicolai
2021-08-03  8:37 ` Phil Sainty
2021-08-03  9:18   ` Phil Sainty [this message]
2021-08-04  7:38     ` Lars Ingebrigtsen

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cdba1a2a077c142cd83d7646a8d036bf@webmail.orcon.net.nz \
    --to=psainty@orcon.net.nz \
    --cc=49843@debbugs.gnu.org \
    --cc=dalanicolai@gmail.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.