all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* New menu creation
@ 2010-05-26 18:39 supreet prasad
  2010-05-27  1:24 ` David Lee
  0 siblings, 1 reply; 7+ messages in thread
From: supreet prasad @ 2010-05-26 18:39 UTC (permalink / raw
  To: Emacs-devel

[-- Attachment #1: Type: text/plain, Size: 482 bytes --]

Hello Emacs Developers,

I am very new to Emacs development. I am now trying to develop my own menu
and I had a few questions about it.

Do I start of writing my code in a new .el file under "lisp" directory? Do I
have to compile emacs and install it everytime I make some changes and want
to test it?
I need to create a new menu item and perform a couple of simple tasks.
Please let me know how I can proceed .
Any links or suggestions would be extremely helpful.

Thanks,
Supreet

[-- Attachment #2: Type: text/html, Size: 885 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* New menu creation
@ 2010-05-26 20:32 supreet
  2010-05-27 14:21 ` Drew Adams
  2010-05-27 14:47 ` Tassilo Horn
  0 siblings, 2 replies; 7+ messages in thread
From: supreet @ 2010-05-26 20:32 UTC (permalink / raw
  To: Help-gnu-emacs


Hi All,

I am very new to Emacs. I am trying to create a new menu in the menu bar.
How do I proceed?
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?
Please let me know if there are any links or info that I can follow.

Thanks,
Supreet
-- 
View this message in context: http://old.nabble.com/New-menu-creation-tp28685978p28685978.html
Sent from the Emacs - Help mailing list archive at Nabble.com.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: New menu creation
  2010-05-26 18:39 supreet prasad
@ 2010-05-27  1:24 ` David Lee
       [not found]   ` <AANLkTikfS8Fk-Fj5eZu-4-OJVbkyJrS0jORSjVg_oTqi@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: David Lee @ 2010-05-27  1:24 UTC (permalink / raw
  To: supreet prasad; +Cc: Emacs-devel

On 05/27/2010 02:39 AM, supreet prasad wrote:
> Hello Emacs Developers,
>
> I am very new to Emacs development. I am now trying to develop my own
> menu and I had a few questions about it.
>
> Do I start of writing my code in a new .el file under "lisp" directory?
Add code to .emacs file.
> Do I have to compile emacs and install it everytime I make some changes
> and want to test it?
No, emacs can source both *.el or *.elc(compiled). Prefer later.
> I need to create a new menu item and perform a couple of simple tasks.
> Please let me know how I can proceed .
Use "easy-menu-define".
> Any links or suggestions would be extremely helpful.
>
> Thanks,
> Supreet

David



^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: New menu creation
  2010-05-26 20:32 New menu creation supreet
@ 2010-05-27 14:21 ` Drew Adams
  2010-06-01 20:09   ` supreet
  2010-05-27 14:47 ` Tassilo Horn
  1 sibling, 1 reply; 7+ messages in thread
From: Drew Adams @ 2010-05-27 14:21 UTC (permalink / raw
  To: 'supreet', Help-gnu-emacs

> 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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: New menu creation
  2010-05-26 20:32 New menu creation supreet
  2010-05-27 14:21 ` Drew Adams
@ 2010-05-27 14:47 ` Tassilo Horn
  1 sibling, 0 replies; 7+ messages in thread
From: Tassilo Horn @ 2010-05-27 14:47 UTC (permalink / raw
  To: help-gnu-emacs

supreet <supreet.prasad@gmail.com> writes:

Hi!

> I am very new to Emacs. I am trying to create a new menu in the menu bar.
> How do I proceed?
> I downloaded the source and I see a lot of .el files under the lisp
> directory. Do I create a new file there?

No, you can do that by placing some code into your ~/.emacs file.  No
need to modify the emacs source code.

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

Have a look at the documentation:

,----[ (info "(elisp)Menu Bar") ]
|      ;; Make a menu keymap (with a prompt string)
|      ;; and make it the menu bar item's definition.
|      (define-key global-map [menu-bar words]
|        (cons "Words" (make-sparse-keymap "Words")))
| 
|      ;; Define specific subcommands in this menu.
|      (define-key global-map
|        [menu-bar words forward]
|        '("Forward word" . forward-word))
|      (define-key global-map
|        [menu-bar words backward]
|        '("Backward word" . backward-word))
`----

To jump to this documentation page inside emacs, put the boxquote
heading

  (info "(elisp)Menu Bar")

into emacs' *scratch* buffer and hit `C-x C-e' after the last closing
paren.

Bye,
Tassilo




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: New menu creation
  2010-05-27 18:01     ` supreet prasad
@ 2010-05-27 18:35       ` Jan Djärv
  0 siblings, 0 replies; 7+ messages in thread
From: Jan Djärv @ 2010-05-27 18:35 UTC (permalink / raw
  To: supreet prasad; +Cc: Emacs-devel

2010-05-27 20:01, supreet prasad skrev:
> Hello David,
>
> Thanks for taking your time and helping me out here. I really appreciate it.
> I was able to create menus.
>
> I now need to know the name of the file in use and find out if a
> particular file exists in some location and do some stuff accordingly.
> How do I proceed?
>

% emacs
C-h i m e l i s p <return> m b u f f e r s <return>
m b u f f e r   f i l e <return>
u u m f i l e s <return> m i n <return> m t e s t <return>

	Jan D.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: New menu creation
  2010-05-27 14:21 ` Drew Adams
@ 2010-06-01 20:09   ` supreet
  0 siblings, 0 replies; 7+ messages in thread
From: supreet @ 2010-06-01 20:09 UTC (permalink / raw
  To: Help-gnu-emacs


Hi,

Thank you very much for all the info. It really helped.
the answers to my questions were so precise. Thanks once again for taking
your time.

Supreet



Drew Adams wrote:
> 
>> 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.
> 
> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/New-menu-creation-tp28685978p28746877.html
Sent from the Emacs - Help mailing list archive at Nabble.com.




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-06-01 20:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-26 20:32 New menu creation supreet
2010-05-27 14:21 ` Drew Adams
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

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.