all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christopher Dimech <dimech@gmx.com>
To: monnier@iro.umontreal.ca
Cc: Michael Heerdegen <michael_heerdegen@web.de>, 58602@debbugs.gnu.org
Subject: bug#58602: 29.0.50; Please document (:documentation FORM) spec for closures
Date: Tue, 18 Oct 2022 04:20:43 +0200	[thread overview]
Message-ID: <trinity-a58594f9-3e37-4d41-946f-8d7ef85b0818-1666059643708@3c-app-mailcom-bs04> (raw)
In-Reply-To: <jwvsfjlc2jq.fsf-monnier+emacs@gnu.org>



> Sent: Tuesday, October 18, 2022 at 2:05 PM
> From: "Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> To: "Michael Heerdegen" <michael_heerdegen@web.de>
> 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 docstring.
> > | 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 completes
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
>
>
>
>
>
>





  reply	other threads:[~2022-10-18  2:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18  0:46 bug#58602: 29.0.50; Please document (:documentation FORM) spec for closures Michael Heerdegen
2022-10-18  2:05 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-18  2:20   ` Christopher Dimech [this message]
2022-10-18  3:16   ` Michael Heerdegen
2022-10-18 13:34     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-18 20:13       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-18 20:39         ` Drew Adams
2022-10-19  1:24         ` Michael Heerdegen
2022-10-19 23:23           ` Michael Heerdegen
2022-10-20  9:35             ` Michael Albinus
2022-10-20 16:50               ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-a58594f9-3e37-4d41-946f-8d7ef85b0818-1666059643708@3c-app-mailcom-bs04 \
    --to=dimech@gmx.com \
    --cc=58602@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.