unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#59014: 29.0.50; single string in function body should act as doc string
@ 2022-11-04 12:26 Nicolas Graner
  2022-11-04 12:55 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Graner @ 2022-11-04 12:26 UTC (permalink / raw)
  To: 59014

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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#59014: 29.0.50; single string in function body should act as doc string
  2022-11-04 12:26 bug#59014: 29.0.50; single string in function body should act as doc string Nicolas Graner
@ 2022-11-04 12:55 ` Eli Zaretskii
  2022-11-04 15:14   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2022-11-04 12:55 UTC (permalink / raw)
  To: Nicolas Graner, Stefan Monnier; +Cc: 59014

> From: Nicolas Graner <nicolas@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?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#59014: 29.0.50; single string in function body should act as doc string
  2022-11-04 12:55 ` Eli Zaretskii
@ 2022-11-04 15:14   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-11-04 16:00     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-11-04 15:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 59014, Nicolas Graner

>> From: Nicolas Graner <nicolas@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






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#59014: 29.0.50; single string in function body should act as doc string
  2022-11-04 15:14   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-11-04 16:00     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-11-04 16:30       ` Nicolas Graner
  2022-11-04 16:52       ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-11-04 16:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 59014, Nicolas Graner

>> 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






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#59014: 29.0.50; single string in function body should act as doc string
  2022-11-04 16:00     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-11-04 16:30       ` Nicolas Graner
  2022-11-04 16:52       ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Nicolas Graner @ 2022-11-04 16:30 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: eliz, 59014

Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#59014: 29.0.50; single string in function body should act as doc string
  2022-11-04 16:00     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-11-04 16:30       ` Nicolas Graner
@ 2022-11-04 16:52       ` Eli Zaretskii
  2022-11-04 17:44         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2022-11-04 16:52 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 59014, nicolas

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Nicolas Graner <nicolas@graner.name>,  59014@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#59014: 29.0.50; single string in function body should act as doc string
  2022-11-04 16:52       ` Eli Zaretskii
@ 2022-11-04 17:44         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-11-04 17:44 UTC (permalink / raw)
  To: 59014-done

>> Should be fixed now,
> Thanks, works now.

Closing,


        Stefan






^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-11-04 17:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 12:26 bug#59014: 29.0.50; single string in function body should act as doc string Nicolas Graner
2022-11-04 12:55 ` Eli Zaretskii
2022-11-04 15:14   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-04 16:00     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-04 16:30       ` Nicolas Graner
2022-11-04 16:52       ` Eli Zaretskii
2022-11-04 17:44         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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).