[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [External] : Supplying DOC string in a `defun' using `defvar'
From: |
Michael Heerdegen |
Subject: |
Re: [External] : Supplying DOC string in a `defun' using `defvar' |
Date: |
Tue, 01 Jun 2021 01:31:30 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Drew Adams <drew.adams@oracle.com> writes:
> (let ((toto "WHAT?!!!!"))
> (put 'bar 'function-documentation toto))
>
> (describe-function 'bar)
Yes, the `function-documentation` property. Its value can even be an
expression, and that will be evaluated whenever the documentation is
requested. In one of the simplest cases, that expression is a variable
holding the documentation:
#+begin_src emacs-lisp
(defvar my-doc "A test function
And this is its documentation")
(defun test () 1)
(put 'test 'function-documentation 'my-doc)
;; Try C-h f test RET
#+end_src
When you change the value of `my-doc' the documentation of `test'
changes magically.
There are cases in Emacs where the expression is used to generate a
docstring dynamically - `pcase' is one example.
Michael.
- Re: Supplying DOC string in a `defun' using `defvar', (continued)
- Re: Supplying DOC string in a `defun' using `defvar', 2QdxY4RzWzUUiLuE, 2021/05/31
- Re: Supplying DOC string in a `defun' using `defvar', Jean Louis, 2021/05/31
- Re: Supplying DOC string in a `defun' using `defvar', Jean Louis, 2021/05/31
- Re: Supplying DOC string in a `defun' using `defvar', Michael Heerdegen, 2021/05/31
- Supplying DOC string in a `defun' using `defvar', ludvig-faddeev, 2021/05/31
- Re: Supplying DOC string in a `defun' using `defvar', Jean Louis, 2021/05/31
- Re: Supplying DOC string in a `defun' using `defvar', Michael Heerdegen, 2021/05/31
- Re: Supplying DOC string in a `defun' using `defvar', Jean Louis, 2021/05/31
RE: [External] : Supplying DOC string in a `defun' using `defvar', Drew Adams, 2021/05/31
- Re: [External] : Supplying DOC string in a `defun' using `defvar',
Michael Heerdegen <=
- [External] : Supplying DOC string in a `defun' using `defvar', ludvig-faddeev, 2021/05/31
- Re: [External] : Supplying DOC string in a `defun' using `defvar', Michael Heerdegen, 2021/05/31
- [External] : Supplying DOC string in a `defun' using `defvar', ludvig-faddeev, 2021/05/31
- Re: [External] : Supplying DOC string in a `defun' using `defvar', Michael Heerdegen, 2021/05/31
- [External] : Supplying DOC string in a `defun' using `defvar', ludvig-faddeev, 2021/05/31
Re: [External] : Supplying DOC string in a `defun' using `defvar', Jean Louis, 2021/05/31