help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Binding functions and parameters


From: Christopher J. White
Subject: Re: Binding functions and parameters
Date: Tue, 28 Jan 2003 09:56:49 -0500
User-agent: Gnus/5.090014 (Oort Gnus v0.14) Emacs/21.2 (powerpc-apple-darwin)

>>>>> "bruce" == Bruce Ashfield <bruce@zedd.org> writes:

bruce> What I'd like to do is create a series of menu entries (or toolbar
bruce> buttons) that trigger different actions. It's no problem creating
bruce> the entries, it's the binding of the function I'd like them to call
bruce> that is causing the problem. I don't know how many entries I'll have
bruce> so I'm creating a single function that takes one argument. I'm 
bruce> triggering on the argument to figure out what to do.

By way of example, here's a way to set a key...

(let ((msg "Hello"))
     (local-set-key [f12] `(lambda() (interactive) (message ,msg))))

The backquote says there are variables inside that need to 
be replaced (prefixed by ,), namely msg.  lambda makes it an
argumentless interactive function.

...cj

-- 
------------------------------------------------------------------------------
 Christopher J. White                                    chris@grierwhite.com
------------------------------------------------------------------------------ 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]