From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Newsgroups: gmane.emacs.help Subject: Re: parametrized function definition Date: Wed, 9 Jul 2008 03:40:35 -0700 (PDT) Organization: http://groups.google.com Message-ID: <1f20c8be-cd52-4750-a65e-5611f0ce8b5f@p25g2000hsf.googlegroups.com> References: <87zlosz4n6.fsf@DEBLAP1.BeNet> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1215603673 30484 80.91.229.12 (9 Jul 2008 11:41:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 9 Jul 2008 11:41:13 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 09 13:41:58 2008 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 1KGY3C-0006HP-0T for geh-help-gnu-emacs@m.gmane.org; Wed, 09 Jul 2008 13:41:34 +0200 Original-Received: from localhost ([127.0.0.1]:56736 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KGY2K-0003Px-CX for geh-help-gnu-emacs@m.gmane.org; Wed, 09 Jul 2008 07:40:40 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!p25g2000hsf.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 26 Original-NNTP-Posting-Host: 24.6.97.120 Original-X-Trace: posting.google.com 1215600036 1073 127.0.0.1 (9 Jul 2008 10:40:36 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 9 Jul 2008 10:40:36 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p25g2000hsf.googlegroups.com; posting-host=24.6.97.120; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.22, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:159988 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:55338 Archived-At: On Jul 8, 10:07 am, Joe Bloggs wrote: > Hi, I am trying to write a function that allows me to quickly bind a key = combination > to insert arbitrary text: > > (defun set-local-key-insert () > "set a local key to insert some text" > (interactive) > (let (keystring textinsert) > (setq keystring (read-key-sequence "Key combination to bind: ")) > (setq textinsert (read-string "Text to insert: ")) > (local-set-key (read-kbd-macro keystring) (lambda () (interactive) (i= nsert textinsert))) > ) > ) > > However, this doesn't work since textinsert is not evaluated until the fu= nction is called with the keybinding. How can I get this to work properly? = I am new to elisp so I imagine it's very simple. Perhaps just the function =E2=80=9Ceval=E2=80=9D? Xah =E2=88=91 http://xahlee.org/ =E2=98=84