From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Norman Walsh Newsgroups: gmane.emacs.help Subject: Getting functions into define-key... Date: Mon, 29 Sep 2003 08:59:17 -0400 Organization: Posted via Supernews, http://www.supernews.com Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87y8w7ycm2.fsf@nwalsh.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1064842725 32753 80.91.224.253 (29 Sep 2003 13:38:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 29 Sep 2003 13:38:45 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 29 15:38:43 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1A3yEd-0002fg-00 for ; Mon, 29 Sep 2003 15:38:43 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 1A3xgq-0005qB-Of for geh-help-gnu-emacs@m.gmane.org; Mon, 29 Sep 2003 09:03:48 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help X-URL: http://nwalsh.com/ User-Agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:yZVQYZ0JRk+2W29eby7F6PRrxuk= Original-X-Complaints-To: abuse@supernews.com Original-Lines: 45 Original-Xref: shelby.stanford.edu gnu.emacs.help:116937 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:12863 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:12863 -----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 | 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 iD8DBQE/eCylOyltUcwYWjsRAuaLAKCE1rUhSBghvetIfOhSGMAgvrUjuACfR1MK m4eG4w1CZC2jpPYB1kji4s0= =pLtC -----END PGP SIGNATURE-----