From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Dimech Newsgroups: gmane.emacs.bugs Subject: bug#58602: 29.0.50; Please document (:documentation FORM) spec for closures Date: Tue, 18 Oct 2022 04:20:43 +0200 Message-ID: References: <87r0z69cxj.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34917"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Michael Heerdegen , 58602@debbugs.gnu.org To: monnier@iro.umontreal.ca Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 18 04:21:17 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1okcEH-0008vA-Cv for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 18 Oct 2022 04:21:17 +0200 Original-Received: from localhost ([::1]:40056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okcEG-0000Tf-9z for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 17 Oct 2022 22:21:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okcE2-0000Sw-UM for bug-gnu-emacs@gnu.org; Mon, 17 Oct 2022 22:21:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51581) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1okcE2-0006wc-EG for bug-gnu-emacs@gnu.org; Mon, 17 Oct 2022 22:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1okcE2-0004tP-0K for bug-gnu-emacs@gnu.org; Mon, 17 Oct 2022 22:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Christopher Dimech Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 18 Oct 2022 02:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58602 X-GNU-PR-Package: emacs Original-Received: via spool by 58602-submit@debbugs.gnu.org id=B58602.166605965518765 (code B ref 58602); Tue, 18 Oct 2022 02:21:01 +0000 Original-Received: (at 58602) by debbugs.gnu.org; 18 Oct 2022 02:20:55 +0000 Original-Received: from localhost ([127.0.0.1]:50659 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okcDu-0004sb-Jf for submit@debbugs.gnu.org; Mon, 17 Oct 2022 22:20:55 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:50643) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okcDs-0004sM-Vi for 58602@debbugs.gnu.org; Mon, 17 Oct 2022 22:20:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1666059643; bh=hKdTLuKfZ4il7iekKTouA11603kRDBEKWW/8Xd6wMj4=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=jO7u97M4fmInb7jwBjLs2yT5Y3bXwT+JxLCN1DeXJJmDF0S00yDAMS7Yl0y7UYH1g 6hoqcfmCa3T0+92uMfN38hgD27FK0vlic4+s3C0uFlhE4ThSqu19w2HRmi413CvHLz 272PNmQjyR88A2cFzUflc+/puDZipE+LzT0149q8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [92.251.127.164] ([92.251.127.164]) by web-mail.gmx.net (3c-app-mailcom-bs04.server.lan [172.19.170.170]) (via HTTP); Tue, 18 Oct 2022 04:20:43 +0200 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:Cow/PVKOfoNec/TIMesAmxkFNdYWRnuktV7sICBum4LZFku0Ol6DXaZydyyv9QnZT2FHY 6OMKHFhrNUJGXpeILzPu+VjGr4skB/Rv7HxsXTv2wNWlcx+32uuKHTLueiG5uPbC+o9KTVoFAv3i X40sHu6dpevNxK8ZBbvfWBq6nzrAR+Kxw3L/P195bvv7yF+s4Hyp4qYRM7DoaLw6Veagw8xoNe3b F+MvvJIsggQEj+KtLJl0zFBqd3dyBQ5YPubxZZoXDlaP2E1jZRsO9Y79mYzf7PSxUkCi7zAhgchM zc= X-UI-Out-Filterresults: notjunk:1;V03:K0:x0ucsLXIZ64=:DfEBy68KD7+PpZjm1LRnoT O2BDFX8RD6OWSNe/80wnbmbWiCAWCllgKSkFNhvna+mAfSIn62llmndITQorA/TpKEifVDzZm QxqtGyK8hlVk+rYCsA2+ruqOnPn9mdhZx6jnOYN2OYvionZOTtdp+0Uhs4qc/TaYtnar0bNs0 olCeQHX0cWMGnvPtxyZw6XtUuPbSjvbwi7NlJVH6mrFABSDPsvUwwr+QsK1x9nhOij/XFAtAY rtSw+Ul8VuWyvQHLiI0EMl6VO098lzbk006iIKqhOFdp8P3rLTujsrBWzARjoZ6HHYkZLVXky 0iTTUzZR5IwlVWxx1QY9U+Ch47QHbOtERHkzOavuISTZjU9YrXcqiQplLOZNeImRIXmQ3BIsm +zAt9M3r6yzeSkGOkA2dSRE+uHey/sCPtH72GvOubFLg0Um/95yWjNfUxLli+t69BP6WmVbs+ 9F+55euav+dXDkPlpHC7qsjjxEpqYlM4ziDSXZr6rePgo0jdlc5ovcJPmASg2M50TkZf4IcEQ UKUSxUwUH2TWqOLAemD404h3DUI/7SCezk3hHjDwUS1hrFouChg1N0lHPXpr2oyNAAlZ39mRv y+MQWkX4EIWshilkW7dbtt5efCFOQGcygc3CYqreaE3lOpX5s8Q7W8WIHSPq18r7Y57zgjxrg OK+rMunP6KjcqnJhuZe0O9ziJasMwYIpIUT6UTnsxnAXPYO1bXIYZ/d9uzwNHatHPKsH6Aob/ IfCkQxloW7kR+wIUJk2HX9h18dynjGx/EaJtmrEiRooaoH29jd9/qGChK+T6RFWKUW27oyUQ X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:245773 Archived-At: > Sent: Tuesday, October 18, 2022 at 2:05 PM > From: "Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knif= e of text editors" > To: "Michael Heerdegen" > Cc: 58602@debbugs.gnu.org > Subject: bug#58602: 29.0.50; Please document (:documentation FORM) spec = for closures > > Michael Heerdegen [2022-10-18 02:46:00] wrote: > > I think we need to document this new feature described in etc/NEWS.25: > > > > | ** Lexical closures can use '(:documentation FORM)' to build their d= ocstring. > > | It should be placed right where the docstring would be, and FORM is = then > > | evaluated (and should return a string) when the closure is built. :documentation would then be safe for the majority of code once emacs comp= letes the lexical binding transition. Would this be correct? > > at least in the ELisp reference manual (dunno, maybe also in the > > docstring of `lambda' and `defun'?). > > [ Our emails crossed: I just sent the following to emacs-devel, but it's > probably better to discuss it here. ] > > Someone pointed out that I forgot to document the `:documentation` > thingy for functions. > > I came up with the text below, but I find it too terse. I'm wondering > whether maybe it should be expanded to a subsubsection maybe, where > I could more easily put some examples. > > Tho, maybe there's a way to make it understandable without an example. > I don't know. I need help. > > > Stefan > > > diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi > index 8b858e0aa01..f85e0498851 100644 > --- a/doc/lispref/functions.texi > +++ b/doc/lispref/functions.texi > @@ -533,6 +533,20 @@ Function Documentation > compiler emit a warning message when it compiles Lisp programs which > use the deprecated calling convention. > > +@cindex Computed documentation string > +@kindex{:documentation} > +Documentation strings are usually completely static, but occasionally > +it can be necessary to generate them dynamically. In some cases this > +can be done by writing a macro which will generate at compile time the > +code of the function, including the desired documentation string. > +But you can also generate the docstring at run-time when the function > +is defined by writing @code{(:documentation @var{form})} instead of > +the documentation string@footnote{This only works in code using > +@code{lexical-binding}.}. Furthermore, you can also compute the > +documentation string on the fly when it is requested by setting > +the @code{function-documentation} property of the function's symbol to > +a Lisp form that should evaluate to a string. > + > @node Function Names > @section Naming a Function > @cindex function definition > > > > > >