GNU bug report logs - #25292
Ambiguity in doc string of defvar

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Thu, 29 Dec 2016 18:20:01 UTC

Severity: minor

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25292 in the body.
You can then email your comments to 25292 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#25292; Package emacs. (Thu, 29 Dec 2016 18:20:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alan Mackenzie <acm <at> muc.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 29 Dec 2016 18:20:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: bug-gnu-emacs <at> gnu.org
Subject: Ambiguity in doc string of defvar
Date: Thu, 29 Dec 2016 18:18:38 +0000
Hello, Emacs.

The doc string for defvar includes this bit:

    The optional argument INITVALUE is evaluated, and used to set
    SYMBOL, only if SYMBOL's value is void.

Supposing SYMBOL's value is bound.  Clearly it does not get set to
INITVALUE.  But in this case is INITVALUE evaluated (and the result
discarded) or not?  The text leaves this ambiguous.  An improvement
would be the appropriate one of the following:

    If SYMBOL's value is void, the optional argument INITVALUE is
    evaluated and used to set SYMBOL.

    INITVALUE is evaluated, and if SYMBOL's value is void, it is used to
    set SYMBOL.

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25292; Package emacs. (Thu, 29 Dec 2016 18:30:02 GMT) Full text and rfc822 format available.

Message #8 received at 25292 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 25292 <at> debbugs.gnu.org
Subject: Re: bug#25292: Ambiguity in doc string of defvar
Date: Thu, 29 Dec 2016 20:29:15 +0200
> Date: Thu, 29 Dec 2016 18:18:38 +0000
> From: Alan Mackenzie <acm <at> muc.de>
> 
>     INITVALUE is evaluated, and if SYMBOL's value is void, it is used to
>     set SYMBOL.                                            ^^

That "it" is ambiguous.  By default, people tend to interpret "it" as
referring to the last noun before it, but that's not what you mean in
this case.

And after all that, are you sure INITVALUE is always evaluated?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25292; Package emacs. (Thu, 29 Dec 2016 19:44:02 GMT) Full text and rfc822 format available.

Message #11 received at 25292 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 25292 <at> debbugs.gnu.org
Subject: Re: bug#25292: Ambiguity in doc string of defvar
Date: Thu, 29 Dec 2016 19:42:38 +0000
Hello, Eli.

On Thu, Dec 29, 2016 at 08:29:15PM +0200, Eli Zaretskii wrote:
> > Date: Thu, 29 Dec 2016 18:18:38 +0000
> > From: Alan Mackenzie <acm <at> muc.de>

> >     INITVALUE is evaluated, and if SYMBOL's value is void, it is used to
> >     set SYMBOL.                                            ^^

> That "it" is ambiguous.  By default, people tend to interpret "it" as
> referring to the last noun before it, but that's not what you mean in
> this case.

Yes, it's no better than what I was complaining about.  :-(

> And after all that, are you sure INITVALUE is always evaluated?

I've had a look at eval.c.  INITVALUE is evaluated only when it's going
to be used.

So, maybe the whole paragraph should look like this:

    If SYMBOL's value is void and the optional argument INITVALUE is
    provided, INITVALUE is evaluated and the result used to set SYMBOL.
    If SYMBOL is buffer-local, its default value is what is set;
    buffer-local values are not affected.  If INITVALUE is missing,
    SYMBOL's value is not set.
 
What do you think?

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25292; Package emacs. (Thu, 29 Dec 2016 20:36:01 GMT) Full text and rfc822 format available.

Message #14 received at 25292 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 25292 <at> debbugs.gnu.org
Subject: Re: bug#25292: Ambiguity in doc string of defvar
Date: Thu, 29 Dec 2016 22:35:07 +0200
> Date: Thu, 29 Dec 2016 19:42:38 +0000
> Cc: 25292 <at> debbugs.gnu.org
> From: Alan Mackenzie <acm <at> muc.de>
> 
>     If SYMBOL's value is void and the optional argument INITVALUE is
>     provided, INITVALUE is evaluated and the result used to set SYMBOL.
                                                           ^^^^^^^^^^^^^
"...to set SYMBOL's value."

>     If SYMBOL is buffer-local, its default value is what is set;
>     buffer-local values are not affected.  If INITVALUE is missing,
>     SYMBOL's value is not set.
>  
> What do you think?

Other than that, LGTM, thanks.




Reply sent to Alan Mackenzie <acm <at> muc.de>:
You have taken responsibility. (Thu, 29 Dec 2016 20:58:02 GMT) Full text and rfc822 format available.

Notification sent to Alan Mackenzie <acm <at> muc.de>:
bug acknowledged by developer. (Thu, 29 Dec 2016 20:58:02 GMT) Full text and rfc822 format available.

Message #19 received at 25292-done <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 25292-done <at> debbugs.gnu.org
Subject: Re: bug#25292: Ambiguity in doc string of defvar
Date: Thu, 29 Dec 2016 20:57:22 +0000
Hello, Eli.

On Thu, Dec 29, 2016 at 10:35:07PM +0200, Eli Zaretskii wrote:
> > Date: Thu, 29 Dec 2016 19:42:38 +0000
> > Cc: 25292 <at> debbugs.gnu.org
> > From: Alan Mackenzie <acm <at> muc.de>

> >     If SYMBOL's value is void and the optional argument INITVALUE is
> >     provided, INITVALUE is evaluated and the result used to set SYMBOL.
>                                                            ^^^^^^^^^^^^^
> "...to set SYMBOL's value."

> >     If SYMBOL is buffer-local, its default value is what is set;
> >     buffer-local values are not affected.  If INITVALUE is missing,
> >     SYMBOL's value is not set.
 
> > What do you think?

> Other than that, LGTM, thanks.

OK.  I've made that correction, and committed the amended doc string.
I'm closing the bug as fixed.

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25292; Package emacs. (Fri, 30 Dec 2016 07:47:02 GMT) Full text and rfc822 format available.

Message #22 received at 25292 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 25292 <at> debbugs.gnu.org
Subject: Re: bug#25292: Ambiguity in doc string of defvar
Date: Fri, 30 Dec 2016 09:46:46 +0200
> Date: Thu, 29 Dec 2016 20:57:22 +0000
> Cc: 25292-done <at> debbugs.gnu.org
> From: Alan Mackenzie <acm <at> muc.de>
> 
> OK.  I've made that correction, and committed the amended doc string.

Thanks, but why on master?...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25292; Package emacs. (Fri, 30 Dec 2016 09:04:02 GMT) Full text and rfc822 format available.

Message #25 received at 25292 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 25292 <at> debbugs.gnu.org
Subject: Re: bug#25292: Ambiguity in doc string of defvar
Date: Fri, 30 Dec 2016 09:02:42 +0000
Hello, Eli.

On Fri, Dec 30, 2016 at 09:46:46AM +0200, Eli Zaretskii wrote:
> > Date: Thu, 29 Dec 2016 20:57:22 +0000
> > Cc: 25292-done <at> debbugs.gnu.org
> > From: Alan Mackenzie <acm <at> muc.de>

> > OK.  I've made that correction, and committed the amended doc string.

> Thanks, but why on master?...

I think I assumed (subconsciously) that emacs-25 was deep frozen prior
to the next release.

Anyhow, I've backported the change onto emacs-25.

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25292; Package emacs. (Fri, 30 Dec 2016 09:43:02 GMT) Full text and rfc822 format available.

Message #28 received at 25292 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 25292 <at> debbugs.gnu.org
Subject: Re: bug#25292: Ambiguity in doc string of defvar
Date: Fri, 30 Dec 2016 11:42:24 +0200
> Date: Fri, 30 Dec 2016 09:02:42 +0000
> Cc: 25292 <at> debbugs.gnu.org
> From: Alan Mackenzie <acm <at> muc.de>
> 
> > > OK.  I've made that correction, and committed the amended doc string.
> 
> > Thanks, but why on master?...
> 
> I think I assumed (subconsciously) that emacs-25 was deep frozen prior
> to the next release.

Not for documentation changes.

> Anyhow, I've backported the change onto emacs-25.

Thanks!




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 27 Jan 2017 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 195 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.