From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ian Eure Newsgroups: gmane.emacs.help Subject: Programmatically creating functions Date: Tue, 21 Oct 2008 10:26:58 -0700 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v929.2) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1224610051 19161 80.91.229.12 (21 Oct 2008 17:27:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Oct 2008 17:27:31 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 21 19:28:30 2008 connect(): Connection refused Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KsL1x-0000du-NY for geh-help-gnu-emacs@m.gmane.org; Tue, 21 Oct 2008 19:28:30 +0200 Original-Received: from localhost ([127.0.0.1]:54751 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KsL0s-0005Ll-85 for geh-help-gnu-emacs@m.gmane.org; Tue, 21 Oct 2008 13:27:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KsL0X-0005LU-B1 for help-gnu-emacs@gnu.org; Tue, 21 Oct 2008 13:27:01 -0400 Original-Received: from [199.232.76.173] (port=34146 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KsL0X-0005LE-1z for help-gnu-emacs@gnu.org; Tue, 21 Oct 2008 13:27:01 -0400 Original-Received: from mail.digg.com ([64.191.203.36]:45597) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KsL0W-0005k4-Qa for help-gnu-emacs@gnu.org; Tue, 21 Oct 2008 13:27:01 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.digg.com (Postfix) with ESMTP id E6C16A853F9 for ; Tue, 21 Oct 2008 10:26:58 -0700 (PDT) X-Virus-Scanned: amavisd-new at X-Spam-Score: -4.26 Original-Received: from mail.digg.com ([127.0.0.1]) by localhost (mail.digg.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GG-Dri9672y3 for ; Tue, 21 Oct 2008 10:26:58 -0700 (PDT) Original-Received: from [10.2.16.90] (diggstage01.digg.com [64.191.203.34]) by mail.digg.com (Postfix) with ESMTP id 7D717A853F4 for ; Tue, 21 Oct 2008 10:26:58 -0700 (PDT) X-Mailer: Apple Mail (2.929.2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:58993 Archived-At: So, I have a list of symbols: '(foo bar baz) I want to iterate over the list and create a function from each which does something like this: (defun call-foo () (interactive) (invoke-stuff 'foo) How can I accomplish this? I can't figure out how to create the function. I've tried a number of approaches, but have not met with success. - eval'ing the defun. Returns a function symbol, but I can't call it. Maybe it's only created within the scope of the (eval) and not callable from outside? - Creating a symbol and using fset to assign a lambda to it's function cell. It sort of works, but I'm unclear on how to pass a variable function name to defun, nor am I clear on how I can make sure it calls invoke-stuff with the right symbol. Help? - Ian