all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* parametrized function definition
@ 2008-07-08 17:07 Joe Bloggs
  2008-07-09  7:06 ` Lennart Borgman (gmail)
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Joe Bloggs @ 2008-07-08 17:07 UTC (permalink / raw)
  To: help-gnu-emacs

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.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-07-14 20:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-08 17:07 parametrized function definition Joe Bloggs
2008-07-09  7:06 ` Lennart Borgman (gmail)
2008-07-09  8:12   ` Thien-Thi Nguyen
2008-07-09  8:19     ` Lennart Borgman (gmail)
     [not found]   ` <mailman.14435.1215591337.18990.help-gnu-emacs@gnu.org>
2008-07-09 14:44     ` Joe Bloggs
2008-07-09 10:40 ` Xah
2008-07-09 12:26 ` Joel J. Adamson
2008-07-09 12:46 ` weber
2008-07-14 20:32   ` Joe Bloggs
     [not found] ` <mailman.14451.1215618411.18990.help-gnu-emacs@gnu.org>
2008-07-14 20:23   ` Joe Bloggs

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.