From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joe Bloggs Newsgroups: gmane.emacs.help Subject: parametrized function definition Date: Tue, 08 Jul 2008 18:07:09 +0100 Message-ID: <87zlosz4n6.fsf@DEBLAP1.BeNet> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1215576354 16339 80.91.229.12 (9 Jul 2008 04:05:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 9 Jul 2008 04:05:54 +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 06:06:41 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 1KGQwy-0002O0-7f for geh-help-gnu-emacs@m.gmane.org; Wed, 09 Jul 2008 06:06:40 +0200 Original-Received: from localhost ([127.0.0.1]:41456 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KGQw7-00058s-2c for geh-help-gnu-emacs@m.gmane.org; Wed, 09 Jul 2008 00:05:47 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail Original-NNTP-Posting-Date: Tue, 08 Jul 2008 12:07:10 -0500 Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:dSgy8EqitJCMaGudAJXWvDkI/4E= Original-Lines: 16 X-Usenet-Provider: http://www.giganews.com Original-X-Trace: sv3-4zQthxGY9X/ho89IYSoO2ST2m1/7Hio9kW1rvgXENufmIiQ07jqDKmgF9c2c0y861rpViE5cZ4lFgNx!iT8VvVwOuJviAfAI8C9aU14xf0XgFTSbl6zdJ+qBgwbFlowJ4Thl Original-X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.39 Original-Xref: news.stanford.edu gnu.emacs.help:159966 X-Mailman-Approved-At: Wed, 09 Jul 2008 00:04:49 -0400 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:55326 Archived-At: 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) (insert textinsert))) ) ) However, this doesn't work since textinsert is not evaluated until the function 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. Thanks.