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 17:57:17 +0800
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/23.2 (gnu/linux)

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

> On Fri, Sep 16, 2011 at 2:28 PM, Thien-Thi Nguyen <ttn@gnuvola.org>
> wrote:
>
>     () C K Kashyap <ckkashyap@gmail.com>
>     () Fri, 16 Sep 2011 14:16:04 +0530
>    
>       Could someone please let me know how I can achieve this?
>    
>     Don't be so hasty; pass ‘eval’ something that is not yet
>     ‘eval’ed.
>
>
> Actually, I used eval because I noticed that if I did not, the formal
> parameter "name" becomes the defined function.

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…

Eric

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