From: Norman Walsh <ndw@nwalsh.com>
Subject: Getting functions into define-key...
Date: Mon, 29 Sep 2003 08:59:17 -0400 [thread overview]
Message-ID: <87y8w7ycm2.fsf@nwalsh.com> (raw)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm guessing there must be some way to do this other than brute force.
I have an alist:
(defvar my-alist
'(("choice1" . "opt1")
("choice2" . 35)
("choice3" . "opt3")))
I want to make a menu-bar menu that contains choice1, choice2, choice3.
If choice1 is selected, I want to evaluate (my-function "opt1"),
If choice2 is selected, I want to evaluate (my-function 35), etc.
I can see a brute-force solution:
(defun my-function-opt1 ()
(interactive)
(my-function "opt1"))
(define-key menu-bar-my-menu [my-choice1]
'("choice1" . my-function-opt1))
But it seems to me that it should be possible to build the menu bar
from the alist. Alas, it's just beyond my elisp skills.
Clues, please?
Be seeing you,
norm
- --
Norman Walsh <ndw@nwalsh.com> | Design and programming are human
http://nwalsh.com/ | activities; forget that and all is
| lost.--B. Stroustrup
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iD8DBQE/eCylOyltUcwYWjsRAuaLAKCE1rUhSBghvetIfOhSGMAgvrUjuACfR1MK
m4eG4w1CZC2jpPYB1kji4s0=
=pLtC
-----END PGP SIGNATURE-----
next reply other threads:[~2003-09-29 12:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-29 12:59 Norman Walsh [this message]
2003-09-29 22:21 ` Getting functions into define-key Kevin Rodgers
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=87y8w7ycm2.fsf@nwalsh.com \
--to=ndw@nwalsh.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).