[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
From menu button, how run more than one command?
From: |
DiGrazia |
Subject: |
From menu button, how run more than one command? |
Date: |
Fri, 24 Feb 2006 17:53:06 -0500 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Windows/20050317) |
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?
- From menu button, how run more than one command?,
DiGrazia <=