From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: help-gnu-emacs@gnu.org
Subject: Re: emacs lisp - unable to write a function maker
Date: Fri, 16 Sep 2011 17:57:17 +0800 [thread overview]
Message-ID: <87iposlshu.fsf@ericabrahamsen.net> (raw)
In-Reply-To: CAGdT1gp4M9Ez878129X2aYA5hBbdeTOjHfkXCU7AL_5KfCketg@mail.gmail.com
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
next prev parent reply other threads:[~2011-09-16 9:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-16 8:46 emacs lisp - unable to write a function maker C K Kashyap
2011-09-16 8:58 ` Thien-Thi Nguyen
2011-09-16 9:26 ` C K Kashyap
2011-09-16 9:40 ` Thien-Thi Nguyen
2011-09-16 9:57 ` Eric Abrahamsen [this message]
2011-09-16 10:17 ` C K Kashyap
2011-09-16 11:19 ` Eric Abrahamsen
2011-09-16 14:06 ` Drew Adams
2011-09-23 15:31 ` Tim Landscheidt
2011-09-23 16:43 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87iposlshu.fsf@ericabrahamsen.net \
--to=eric@ericabrahamsen.net \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).