[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Supplying DOC string in a `defun' using `defvar'
From: |
Robert Thorpe |
Subject: |
Re: Supplying DOC string in a `defun' using `defvar' |
Date: |
Tue, 01 Jun 2021 23:15:19 +0100 |
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.
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