help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Supplying DOC string in a `defun' using `defvar'


From: Jean Louis
Subject: Re: Supplying DOC string in a `defun' using `defvar'
Date: Tue, 1 Jun 2021 02:13:00 +0300
User-agent: Mutt/2.0.7+183 (3d24855) (2021-05-28)

* ludvig-faddeev@gmx.com <ludvig-faddeev@gmx.com> [2021-06-01 02:00]:
> Can the DOC string in a `defun' be supplied using a `defvar'?

Why not show your idea? I cannot understand that. I can think of this:

(defvar my-doc "Hello")

(defun my-fun ()
  my-doc
  (ignore))

It did not work, but I think it should.

my-fun is a Lisp function.

(my-fun)

Not documented.

Maybe this way:

(defmacro my-fun ()
  `(defun my-fun ()
     ,my-doc
     (ignore)))

(my-fun) ⇒ nil ;; defines function by using value defined with defvar

my-fun is a Lisp function.

(my-fun)

Hello



-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]