GNU bug report logs - #59014
29.0.50; single string in function body should act as doc string

Previous Next

Package: emacs;

Reported by: Nicolas Graner <nicolas <at> graner.name>

Date: Fri, 4 Nov 2022 12:27:01 UTC

Severity: normal

Found in version 29.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

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 59014 in the body.
You can then email your comments to 59014 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#59014; Package emacs. (Fri, 04 Nov 2022 12:27:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nicolas Graner <nicolas <at> graner.name>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 04 Nov 2022 12:27:02 GMT) Full text and rfc822 format available.

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

From: Nicolas Graner <nicolas <at> graner.name>
To: bug-gnu-emacs <at> gnu.org 
Subject: 29.0.50; single string in function body should act as doc string
Date: Fri, 04 Nov 2022 13:26:22 +0100
According to the Emacs lisp manual, node "Documentation Strings of Functions":

    You may wonder how the documentation string could be optional, since
    there are required components of the function that follow it (the
    body). Since evaluation of a string returns that string, without any
    side effects, it has no effect if it is not the last form in the
    body. Thus, in practice, there is no confusion between the first
    form of the body and the documentation string; if the only body form
    is a string then it serves both as the return value and as the
    documentation.

This last sentence is no longer true in 29.0.50, the single string is
not used as doc string:

(defun f () "foo")
⇒ f
(f)
⇒ "foo"
(documentation 'f)
⇒ nil
(emacs-version)
⇒ "GNU Emacs 29.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0)
 of 2022-11-03"

Hope this helps,
Nicolas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59014; Package emacs. (Fri, 04 Nov 2022 12:57:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Nicolas Graner <nicolas <at> graner.name>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 59014 <at> debbugs.gnu.org
Subject: Re: bug#59014: 29.0.50;
 single string in function body should act as doc string
Date: Fri, 04 Nov 2022 14:55:54 +0200
> From: Nicolas Graner <nicolas <at> graner.name>
> Date: Fri, 04 Nov 2022 13:26:22 +0100
> 
> According to the Emacs lisp manual, node "Documentation Strings of Functions":
> 
>     You may wonder how the documentation string could be optional, since
>     there are required components of the function that follow it (the
>     body). Since evaluation of a string returns that string, without any
>     side effects, it has no effect if it is not the last form in the
>     body. Thus, in practice, there is no confusion between the first
>     form of the body and the documentation string; if the only body form
>     is a string then it serves both as the return value and as the
>     documentation.
> 
> This last sentence is no longer true in 29.0.50, the single string is
> not used as doc string:
> 
> (defun f () "foo")
> ⇒ f
> (f)
> ⇒ "foo"
> (documentation 'f)
> ⇒ nil
> (emacs-version)
> ⇒ "GNU Emacs 29.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0)
>  of 2022-11-03"

Thanks.

Stefan, this seems to be due to your changes in commit
39e8fd357dd0a1f3776c05eee2cc5be451686712.  Specifically, the new
function-documentation returns nil in this case.  Could you please
take a look at this?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59014; Package emacs. (Fri, 04 Nov 2022 15:16:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 59014 <at> debbugs.gnu.org, Nicolas Graner <nicolas <at> graner.name>
Subject: Re: bug#59014: 29.0.50; single string in function body should act
 as doc string
Date: Fri, 04 Nov 2022 11:14:55 -0400
>> From: Nicolas Graner <nicolas <at> graner.name>
>> Date: Fri, 04 Nov 2022 13:26:22 +0100
>> 
>> According to the Emacs lisp manual, node "Documentation Strings of Functions":
>> 
>>     You may wonder how the documentation string could be optional, since
>>     there are required components of the function that follow it (the
>>     body). Since evaluation of a string returns that string, without any
>>     side effects, it has no effect if it is not the last form in the
>>     body. Thus, in practice, there is no confusion between the first
>>     form of the body and the documentation string; if the only body form
>>     is a string then it serves both as the return value and as the
>>     documentation.

Boy, I should (re)read this manual more regularly.  I was convinced the
intended behavior was to treat (defun f () "foo") as a function with no
docstring (as witnessed in the resulting behavior I implemented).

> Stefan, this seems to be due to your changes in commit
> 39e8fd357dd0a1f3776c05eee2cc5be451686712.  Specifically, the new
> function-documentation returns nil in this case.  Could you please
> take a look at this?

Will do,


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59014; Package emacs. (Fri, 04 Nov 2022 16:01:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 59014 <at> debbugs.gnu.org, Nicolas Graner <nicolas <at> graner.name>
Subject: Re: bug#59014: 29.0.50; single string in function body should act
 as doc string
Date: Fri, 04 Nov 2022 12:00:24 -0400
>> Stefan, this seems to be due to your changes in commit
>> 39e8fd357dd0a1f3776c05eee2cc5be451686712.  Specifically, the new
>> function-documentation returns nil in this case.  Could you please
>> take a look at this?

Should be fixed now,


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59014; Package emacs. (Fri, 04 Nov 2022 16:31:02 GMT) Full text and rfc822 format available.

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

From: Nicolas Graner <nicolas <at> graner.name>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: eliz <at> gnu.org, 59014 <at> debbugs.gnu.org
Subject: Re: bug#59014: 29.0.50; single string in function body should act
 as doc string
Date: Fri, 04 Nov 2022 17:30:14 +0100
Stefan Monnier <monnier <at> iro.umontreal.ca> wrote on 2022-11-04 12:00:
>>> Stefan, this seems to be due to your changes in commit
>>> 39e8fd357dd0a1f3776c05eee2cc5be451686712.  Specifically, the new
>>> function-documentation returns nil in this case.  Could you please
>>> take a look at this?
>
> Should be fixed now,

Thanks.
Nicolas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59014; Package emacs. (Fri, 04 Nov 2022 16:53:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 59014 <at> debbugs.gnu.org, nicolas <at> graner.name
Subject: Re: bug#59014: 29.0.50; single string in function body should act
 as doc string
Date: Fri, 04 Nov 2022 18:52:31 +0200
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Nicolas Graner <nicolas <at> graner.name>,  59014 <at> debbugs.gnu.org
> Date: Fri, 04 Nov 2022 12:00:24 -0400
> 
> >> Stefan, this seems to be due to your changes in commit
> >> 39e8fd357dd0a1f3776c05eee2cc5be451686712.  Specifically, the new
> >> function-documentation returns nil in this case.  Could you please
> >> take a look at this?
> 
> Should be fixed now,

Thanks, works now.




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Fri, 04 Nov 2022 17:45:02 GMT) Full text and rfc822 format available.

Notification sent to Nicolas Graner <nicolas <at> graner.name>:
bug acknowledged by developer. (Fri, 04 Nov 2022 17:45:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: 59014-done <at> debbugs.gnu.org
Subject: Re: bug#59014: 29.0.50; single string in function body should act
 as doc string
Date: Fri, 04 Nov 2022 13:44:18 -0400
>> Should be fixed now,
> Thanks, works now.

Closing,


        Stefan





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 03 Dec 2022 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 277 days ago.

Previous Next


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