From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: DiGrazia Newsgroups: gmane.emacs.help Subject: From menu button, how run more than one command? Date: Fri, 24 Feb 2006 17:53:06 -0500 Message-ID: <43FF8E52.7030207@localnet.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1141402073 29820 80.91.229.2 (3 Mar 2006 16:07:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 3 Mar 2006 16:07:53 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 03 17:07:52 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FFCoQ-0006Wb-8m for geh-help-gnu-emacs@m.gmane.org; Fri, 03 Mar 2006 17:07:26 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FFCoP-0001P0-Ap for geh-help-gnu-emacs@m.gmane.org; Fri, 03 Mar 2006 11:07:25 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FEgBx-0007xb-2i for help-gnu-emacs@gnu.org; Thu, 02 Mar 2006 00:17:33 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FCloA-0003k8-3c for help-gnu-emacs@gnu.org; Fri, 24 Feb 2006 17:53:07 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FClo8-0003jF-Ph for help-gnu-emacs@gnu.org; Fri, 24 Feb 2006 17:53:05 -0500 Original-Received: from [207.251.201.56] (helo=extsmtp4.localnet.com) by monty-python.gnu.org with smtp (Exim 4.52) id 1FCloL-00048Q-Gr for help-gnu-emacs@gnu.org; Fri, 24 Feb 2006 17:53:17 -0500 Original-Received: (qmail 4215 invoked by uid 1011); 24 Feb 2006 22:53:03 -0000 Original-Received: from 10.0.7.15 by bombastic (envelope-from , uid 1004) with qmail-scanner-1.23st (spamassassin: 3.0.3. perlscan: 1.23st. Clear:RC:0(10.0.7.15):SA:0(0.0/10.0):. Processed in 0.285121 secs); 24 Feb 2006 22:53:03 -0000 Original-Received: from unknown (HELO smtp2.localnet.com) (10.0.7.15) by extsmtp4.localnet.com with SMTP; 24 Feb 2006 22:53:02 -0000 Original-Received: (qmail 22223 invoked from network); 24 Feb 2006 22:53:02 -0000 Original-Received: from unknown (HELO ?127.0.0.1?) (66.153.67.5) by mail1.localnet.com with SMTP; 24 Feb 2006 22:53:02 -0000 User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:33482 Archived-At: I want to have a menu whose buttons each executes something like this: (cd "c:/blah/") (find-file) ;Do not specify file; instead, open the Find File window. That is, I want each button to run "cd" and then "find-file" interactively. The code below works, but note that the menu button calls function "abc". If the menu contains many buttons, each button would need a dedicated function. (defvar my-menu (make-sparse-keymap)) (define-key my-menu [rmx] '(menu-item "FILE" abc)) ;executes function abc (defun abc () (interactive) (cd "C:/emacs") (call-interactively 'find-file) ) Is there a way to write the "define-key" so that I don't need a separate function? Or, is there a way to pass an argument from "menu-item" to a function?