]> git.eshelyaron.com Git - emacs.git/commit
Single string literal in body is return value only, not doc string
authorMattias EngdegÄrd <mattiase@acm.org>
Wed, 6 Mar 2024 11:03:06 +0000 (12:03 +0100)
committerEshel Yaron <me@eshelyaron.com>
Mon, 11 Mar 2024 09:14:57 +0000 (10:14 +0100)
commit1a3c21a7fa7ba4c4345ee1ed74ef836d2d4f80a0
tree8b6fea2445bd2e79caa370b84198d0df90cf497a
parent11dc4c00d02844995375c4578aa04f82e0350ee2
Single string literal in body is return value only, not doc string

A function or macro body consisting of a single string literal now only
uses it as a return value.  Previously, it had the dual uses as return
value and doc string, which was never what the programmer wanted and
had some inconvenient consequences (bug#69387).

This change applies to `lambda`, `defun`, `defsubst` and `defmacro`
forms; most other defining forms already worked in the sensible way.

* lisp/emacs-lisp/bytecomp.el (byte-compile-lambda):
Don't use a lone string literal as doc string.
* test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-defun.el
(foo): Update docstring warning test.
* doc/lispref/functions.texi (Function Documentation): Update.
* etc/NEWS: Announce.

(cherry picked from commit 61b2f5f96b1d9dfd2fd908e09fac0d4163049c42)
doc/lispref/functions.texi
etc/NEWS
lisp/emacs-lisp/bytecomp.el
test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-defun.el