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:43:38 +0300
User-agent: Mutt/2.0.7+183 (3d24855) (2021-05-28)

* ludvig-faddeev@gmx.com <ludvig-faddeev@gmx.com> [2021-06-01 02:34]:
> 
> 
> > 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. 

The above did not work, that is why you have to think with below one,
which does work, but Drew's example is superior.

> > 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/
> > 
> >
> 

-- 
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]