unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: RD <rjjd@localnet.com>
Subject: From menu button, how run more than one command?
Date: Fri, 24 Feb 2006 22:07:21 -0500	[thread overview]
Message-ID: <11vvif44kod09bd@corp.supernews.com> (raw)

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	other threads:[~2006-02-25  3:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-25  3:07 RD [this message]
2006-02-27 13:35 ` From menu button, how run more than one command? Mathias Dahl
2006-03-01 18:51   ` Kevin Rodgers
     [not found]   ` <mailman.166.1141291544.2835.help-gnu-emacs@gnu.org>
2006-03-02 10:50     ` Mathias Dahl
2006-03-02 16:01     ` Johan Bockgård
2006-03-01  4:47 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2006-02-24 22:53 DiGrazia

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=11vvif44kod09bd@corp.supernews.com \
    --to=rjjd@localnet.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).