[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: parametrized function definition
From: |
Xah |
Subject: |
Re: parametrized function definition |
Date: |
Wed, 9 Jul 2008 03:40:35 -0700 (PDT) |
User-agent: |
G2/1.0 |
On Jul 8, 10:07 am, Joe Bloggs <w...@cares.invalid> 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)
> (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.
Perhaps just the function “eval”?
Xah
∑ http://xahlee.org/
☄