From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: New menu creation Date: Thu, 27 May 2010 07:21:15 -0700 Message-ID: <5D11D6FCAED84077867BBFADD477A806@us.oracle.com> References: <28685978.post@talk.nabble.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1274971875 16646 80.91.229.12 (27 May 2010 14:51:15 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 27 May 2010 14:51:15 +0000 (UTC) To: "'supreet'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu May 27 16:50:59 2010 connect(): No such file or directory Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OHeQ9-00068D-Qv for geh-help-gnu-emacs@m.gmane.org; Thu, 27 May 2010 16:50:54 +0200 Original-Received: from localhost ([127.0.0.1]:43763 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHeQ9-0002hc-0h for geh-help-gnu-emacs@m.gmane.org; Thu, 27 May 2010 10:50:53 -0400 Original-Received: from [140.186.70.92] (port=35671 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHdyl-00018P-FQ for Help-gnu-emacs@gnu.org; Thu, 27 May 2010 10:22:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OHdyk-0000DL-Ae for Help-gnu-emacs@gnu.org; Thu, 27 May 2010 10:22:35 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]:30469) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHdyk-0000C4-5e for Help-gnu-emacs@gnu.org; Thu, 27 May 2010 10:22:34 -0400 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o4REMSRX013875 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 27 May 2010 14:22:29 GMT Original-Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o4RC2031006607; Thu, 27 May 2010 14:22:26 GMT Original-Received: from abhmt021.oracle.com by acsmt354.oracle.com with ESMTP id 273736731274970069; Thu, 27 May 2010 07:21:09 -0700 Original-Received: from dradamslap1 (/10.175.228.31) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 27 May 2010 07:21:09 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <28685978.post@talk.nabble.com> Thread-Index: Acr9ouwIWy4eXy1fQFK3dBT6bUy41wAAL1Ig X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 X-Auth-Type: Internal IP X-Source-IP: acsinet15.oracle.com [141.146.126.227] X-CT-RefId: str=0001.0A090209.4BFE8026.0005:SCFMA922111,ss=1,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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:73777 Archived-At: > 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.