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

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

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


From: ludvig-faddeev
Subject: Supplying DOC string in a `defun' using `defvar'
Date: Tue, 1 Jun 2021 01:32:41 +0200


> Sent: Tuesday, June 01, 2021 at 11:13 AM
> From: "Jean Louis" <bugs@gnu.support>
> To: ludvig-faddeev@gmx.com
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Supplying DOC string in a `defun' using `defvar'
>
> * 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.

I also would like for the example to work.
 
> 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]