[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Supplying DOC string in a `defun' using `defvar'
From: |
Christopher Dimech |
Subject: |
Supplying DOC string in a `defun' using `defvar' |
Date: |
Wed, 2 Jun 2021 01:08:00 +0200 |
> Sent: Wednesday, June 02, 2021 at 10:15 AM
> From: "Robert Thorpe" <rt@robertthorpeconsulting.com>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: ndokos@gmail.com, help-gnu-emacs@gnu.org
> Subject: Re: Supplying DOC string in a `defun' using `defvar'
>
> I tried this example out. In a emacs-lisp-mode buffer I put the following:
>
> (setq lexical-binding t)
>
> (defvar my-doc "foobar")
>
> (defun my-fun (x)
> (:documentation my-doc)
> (+ x 42))
>
> I evaluated each of them in turn. After that when I do C-h f on my-fun
> I get "foobar". What is a little strange is that Emacs tells me that
> my-fun is a "Lisp closure".
>
> If I *don't* have the first line (the lexical-binding one) then this
> doesn't work. In that case C-h f tells me that my-fun is a "Lisp
> function" and has no documentation.
Correct
> BR,
> Robert Thorpe
>
Re: Supplying DOC string in a `defun' using `defvar', Jean Louis, 2021/06/01
Re: Supplying DOC string in a `defun' using `defvar', Nick Dokos, 2021/06/01
Re: Supplying DOC string in a `defun' using `defvar', Michael Heerdegen, 2021/06/01