unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 41727@debbugs.gnu.org
Subject: bug#41727: 26.3; Doc of `define-minor-mode' and minor-mode commands
Date: Tue, 9 Jun 2020 08:40:12 -0700 (PDT)	[thread overview]
Message-ID: <4a54194b-effc-41a1-836f-2fb71ad11a5a@default> (raw)
In-Reply-To: <87h7vkbrh3.fsf@web.de>

> > > How about leaving only cases like ARG -> '- undocumented?
> > >
> > >   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 if the argument is a
> > >   positive integer or omitted or nil.
> >
> > That's what we say now, and the reason I filed the bug.
> 
> No, it's not, it doesn't contradict the implementation.  Did you read
> carefully?

I think I did.  We don't use exactly the same words, but
I think we do say just that.

  When called from Lisp, the mode command toggles the mode if the
  argument is `toggle', 

Verbatim the same.

  disables the mode if the argument is a non-positive integer,

Verbatim the same.

  and enables the mode otherwise (including
  if the argument is omitted or nil or a positive integer).

OK, your text doesn't say "otherwise".  Your text is less
exact, since the "otherwise" is correct - omitted/nil and
positive integer constitute a subset of what's true.

Is that really your suggestion, to not document that
something other than omitted, nil and a positive integer
enables the mode?  To me, that would be a step backward,
not forward.  That doesn't correspond to what the code does.

> > Consider a case where some command A invokes a minor-mode
> > command B, to turn B on or off for some purpose/extent.
> > Consider the case where A's prefix arg is passed to B, to
> > do that.
> >
> > The programmer writing the Lisp code to define A should
> > know that s?he can just pass the raw prefix arg.  The
> > resulting code will be simpler, easier to read, etc.
> 
> We don't know if the original author intended the semantics of the
> documentation or of the implementation.  If we are sure the current
> implementation is what was intended I would be ok with documenting it,
> but it's really far from important IMHO.

Until the code is changed, e.g. because someone thinks
the behavior is wrong, the doc should reflect it.  I,
for one, think the behavior is OK as is.  The use case
I just gave (cited above) is one argument for it.

Many commands have the `interactive' form massage the
prefix arg, to present something a bit different to
the body.  E.g., a change from raw to numeric prefix
value is done in the `interactive' form, for whatever
reason.

This command doesn't work that way.  Instead, what is
passed to Lisp is the raw prefix arg, and it is the
body (which also corresponds to a non-interactive call)
that converts that to a numeric value.

Someone (and `d-m-mode' has been worked over more than
once wrt its interactive-vs-Lisp behavior, I believe)
presumably deliberately decided that this command
should act differently.

Many commands (most, I think) make it so that the body
gets just what it needs, and any compensation for
interactivity is taken care of only in the `interactive'
spec.  Someone presumably thought this command should
be an exception in that regard.

Until someone decides otherwise, and changes the
behavior (which I doubt will happen, in particular
because of backward incompatibility), IMO it's the doc
that needs to be changed to fit the behavior, not the
other way around.

I don't understand the hesitation to make the doc say
just what the truth is.  It doesn't take any more text.
I already suggested wording, and I made clear that
other wording that says the same thing (describes the
behavior accurately) would be fine instead.

What's the pushback, here?  Why shouldn't we make the
doc tell the real story wrt the ARG that Lisp expects?





  parent reply	other threads:[~2020-06-09 15:40 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-05 20:39 bug#41727: 26.3; Doc of `define-minor-mode' and minor-mode commands Drew Adams
2020-06-06  0:01 ` Drew Adams
2020-06-07 10:04   ` Michael Heerdegen
2020-06-07 16:06     ` Drew Adams
2020-06-07 16:19       ` Michael Heerdegen
2020-06-07 16:30         ` Drew Adams
2020-06-06  6:13 ` Eli Zaretskii
2020-06-06 16:45   ` Drew Adams
2020-06-06 18:56     ` Eli Zaretskii
2020-06-07 10:08       ` Michael Heerdegen
2020-06-07 14:31         ` Eli Zaretskii
2020-06-07 14:45           ` Michael Heerdegen
2020-06-07 16:08         ` Drew Adams
     [not found]       ` <<87wo4jb33s.fsf@web.de>
     [not found]         ` <<83y2oz6j6x.fsf@gnu.org>
2020-06-07 16:16           ` Drew Adams
2020-06-08 17:16             ` Michael Heerdegen
2020-06-08 17:38               ` Drew Adams
2020-06-09  7:58                 ` Michael Heerdegen
2020-06-09 14:39                   ` Eli Zaretskii
2020-06-09 15:21                     ` Michael Heerdegen
2020-06-09 15:40                   ` Drew Adams [this message]
     [not found]                 ` <<87h7vkbrh3.fsf@web.de>
     [not found]                   ` <<835zc0717e.fsf@gnu.org>
2020-06-09 15:51                     ` Drew Adams
2021-09-25 15:41       ` Stefan Kangas
2021-09-25 16:58         ` bug#41727: [External] : " Drew Adams
2021-09-25 17:18           ` Eli Zaretskii
     [not found] <<963d4189-17dc-4f4e-9993-0335fa271e50@default>
     [not found] ` <<83k10kafha.fsf@gnu.org>
     [not found]   ` <<9d7f8447-1c0b-46db-a40c-c1ed2a398c46@default>
     [not found]     ` <<838sh081lt.fsf@gnu.org>
2020-06-06 20:39       ` 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=4a54194b-effc-41a1-836f-2fb71ad11a5a@default \
    --to=drew.adams@oracle.com \
    --cc=41727@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    /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).