all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'supreet'" <supreet.prasad@gmail.com>, <Help-gnu-emacs@gnu.org>
Subject: RE: New menu creation
Date: Thu, 27 May 2010 07:21:15 -0700	[thread overview]
Message-ID: <5D11D6FCAED84077867BBFADD477A806@us.oracle.com> (raw)
In-Reply-To: <28685978.post@talk.nabble.com>

> I am very new to Emacs. I am trying to create a new menu in 
> the menu bar. How do I proceed?

Here is one way. Paste this text in a new file `mine.el', save it, and do `M-x
load-file RET mine.el'. (`M-x' means `ALT-x'.)

;; 1. Define a keymap variable:
(defvar my-menu (make-sparse-keymap "My Great Menu"))

;; 2. Put it on the menu bar:
(define-key global-map [menu-bar mine] (cons "Mine" my-menu))

;; 3. Add menu items:
(define-key my-menu [my-cmd1]
 '(menu-item "Command Uno" my-cmd1 :help "My first command"))
(define-key my-menu [forward-char]
 '(menu-item "Command Duo" my-cmd1 :help "Move forward one char"))

...

Alternatively, skip defining a variable (step #1) and just define everything
directly wrt the `global-map':

(define-key global-map [menu-bar mine]
 (cons "Mine" (make-sparse-keymap "My Great Menu")))

(define-key global-map [menu-bar mine my-cmd1]
 '(menu-item "Command Uno" my-cmd1 :help "My first command"))

...

> I downloaded the source and I see a lot of .el files under the lisp
> directory. Do I create a new file there? How do I link it?

No. Put the file in any directory you like, then add that directory to your
`load-path':

(add-to-list 'load-path "/my/directory/for/my/lisp/") 

> Please let me know if there are any links or info that I can follow.

* `C-h i', then choose Elisp, for the Emacs-Lisp manual. Then `i', type `menu',
and hit `TAB'. You'll see the manual pages about the menus. Choose the
completion candidate `menu bar' by typing ` bar' and hitting `RET'. That takes
you to the manual page (node) `Menu Bar'. Read.

* Google `emacs wiki' and pick the first search hit: `EmacsWiki: Site Map'.
Search there for `menu bar'. Pick the first search hit: `EmacsWiki: Menu Bar'.
You are here: http://www.emacswiki.org/emacs/MenuBar. Read. Explore the wiki for
more.

HTH.





  reply	other threads:[~2010-05-27 14:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-26 20:32 New menu creation supreet
2010-05-27 14:21 ` Drew Adams [this message]
2010-06-01 20:09   ` supreet
2010-05-27 14:47 ` Tassilo Horn
  -- strict thread matches above, loose matches on Subject: below --
2010-05-26 18:39 supreet prasad
2010-05-27  1:24 ` David Lee
     [not found]   ` <AANLkTikfS8Fk-Fj5eZu-4-OJVbkyJrS0jORSjVg_oTqi@mail.gmail.com>
2010-05-27 18:01     ` supreet prasad
2010-05-27 18:35       ` New " Jan Djärv

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5D11D6FCAED84077867BBFADD477A806@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=Help-gnu-emacs@gnu.org \
    --cc=supreet.prasad@gmail.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.