[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#59014: 29.0.50; single string in function body should act as doc str
From: |
Stefan Monnier |
Subject: |
bug#59014: 29.0.50; single string in function body should act as doc string |
Date: |
Fri, 04 Nov 2022 11:14:55 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>> 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