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

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

Re: emacs lisp - unable to write a function maker


From: Eric Abrahamsen
Subject: Re: emacs lisp - unable to write a function maker
Date: Fri, 16 Sep 2011 19:19:08 +0800
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/23.2 (gnu/linux)

On Fri, Sep 16 2011, C K Kashyap wrote:

>     Perhaps I'm ruining some didactic exercise here, but if you're
>     using
>     eval on something you don't want eval'd until the function is
>     run, you
>     should backquote it. This works for me:
>    
>    
>     (defun functionmaker (name form)
>      (eval
>       `(defun ,name ()
>          ,form)))
>    
>     I used to associate backquoting exclusively with macros, but I
>     think
>     that was wrong thinking.
>    
>     Hope someone will correct me if I've done something dumb here…
>
>
>
> Wow .. .This worked as I was wanting ... Could you please point me to
> some documentation that would help me with things like, when to use
> "," in front of the name etc?
>
> Regards,
> Kashyap 

I'm the wrong one to ask about this -- my elisp only works because of
liberal sprinklings of pixie dust -- but if you read the elisp manual on
macros, and keep in mind that backquoting works in contexts other than
that of macros, you'll be most of the way there. What I used in this
tiny example (plus the ,@ form for splicing lists) is pretty much all
there is to it, though the ramifications do get complicated…

Good luck!

E

-- 
GNU Emacs 23.2.1 (i686-pc-linux-gnu, GTK+ Version 2.24.4)
 of 2011-04-04 on rothera, modified by Debian




reply via email to

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