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

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

From menu button, how run more than one command?


From: RD
Subject: From menu button, how run more than one command?
Date: Fri, 24 Feb 2006 22:07:21 -0500
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

I want to have a menu whose buttons each executes more than one command, something like this:

(cd "c:/blah/")
(call-interactively 'find-file) ;open the Find File window.


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 the function?


reply via email to

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