From: Thien-Thi Nguyen <ttn@gnuvola.org>
To: "Lennart Borgman \(gmail\)" <lennart.borgman@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: parametrized function definition
Date: Wed, 09 Jul 2008 10:12:44 +0200 [thread overview]
Message-ID: <87zlorh3wj.fsf@ambire.localdomain> (raw)
In-Reply-To: <48746376.1000306@gmail.com> (Lennart Borgman's message of "Wed, 09 Jul 2008 09:06:30 +0200")
() "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
() Wed, 09 Jul 2008 09:06:30 +0200
> (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)))))
You can remove textinsert from let and make it a defvar instead.
(defvar textinsert nil)
Yes, but that would defeat the presumed intention of using `textinsert'
as a local variable. Practically, this means `set-local-key-insert'
invocations clobber previous invocations' state (last invocation wins).
Probably OP wants `lexical-let'.
thi
next prev parent reply other threads:[~2008-07-09 8:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zlorh3wj.fsf@ambire.localdomain \
--to=ttn@gnuvola.org \
--cc=help-gnu-emacs@gnu.org \
--cc=lennart.borgman@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).