From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.help Subject: Re: emacs lisp - unable to write a function maker Date: Fri, 16 Sep 2011 17:57:17 +0800 Message-ID: <87iposlshu.fsf@ericabrahamsen.net> References: <87pqj0q2wo.fsf@ambire.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1316167069 31342 80.91.229.12 (16 Sep 2011 09:57:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 16 Sep 2011 09:57:49 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Sep 16 11:57:46 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R4VB2-0007Ll-If for geh-help-gnu-emacs@m.gmane.org; Fri, 16 Sep 2011 11:57:45 +0200 Original-Received: from localhost ([::1]:55017 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4VB1-0006bt-Ja for geh-help-gnu-emacs@m.gmane.org; Fri, 16 Sep 2011 05:57:43 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:38931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4VAw-0006bd-6Q for help-gnu-emacs@gnu.org; Fri, 16 Sep 2011 05:57:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R4VAr-0002Ud-T2 for help-gnu-emacs@gnu.org; Fri, 16 Sep 2011 05:57:38 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:42760) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R4VAr-0002TW-JA for help-gnu-emacs@gnu.org; Fri, 16 Sep 2011 05:57:33 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1R4VAp-0007Go-SG for help-gnu-emacs@gnu.org; Fri, 16 Sep 2011 11:57:31 +0200 Original-Received: from 125.33.7.201 ([125.33.7.201]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 16 Sep 2011 11:57:31 +0200 Original-Received: from eric by 125.33.7.201 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 16 Sep 2011 11:57:31 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 37 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 125.33.7.201 User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:QsAoCZqgUcvIYcH+d/LkGent8DI= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:82248 Archived-At: On Fri, Sep 16 2011, C K Kashyap wrote: > On Fri, Sep 16, 2011 at 2:28 PM, Thien-Thi Nguyen > wrote: > > () C K Kashyap > () 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