unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* adding perl-mode menu
@ 2005-02-13 20:54 bluj
  2005-02-14  1:42 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: bluj @ 2005-02-13 20:54 UTC (permalink / raw)


Hello,
I have used emacs for quite a while, but have never delved into
customization or lisp.
I would like to add a menu in emacs, only in the perl major mode.

I thought that this would do it:

(define-key perl-mode-map [menu-bar cust]
  (cons "Cust" (make-sparse-keymap "Cust")))

what am i doing wrong???? if i change perl-mode-map to global-map i am
fine...
Why is there no documentation on this for gnu emacs??? If someone can
point me to a doc that goes into specifics about this, I would be
greatful. The faq only covers adding to global-map....

thanks
jonathan

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

* Re: adding perl-mode menu
  2005-02-13 20:54 adding perl-mode menu bluj
@ 2005-02-14  1:42 ` Stefan Monnier
  2005-02-14  4:13   ` bluj
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2005-02-14  1:42 UTC (permalink / raw)


> I thought that this would do it:

> (define-key perl-mode-map [menu-bar cust]
>   (cons "Cust" (make-sparse-keymap "Cust")))

> what am i doing wrong????

Nothing at first sight.  Tell us where/when you do it and what happens.


        Stefan

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

* Re: adding perl-mode menu
  2005-02-14  1:42 ` Stefan Monnier
@ 2005-02-14  4:13   ` bluj
  2005-02-14 13:59     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: bluj @ 2005-02-14  4:13 UTC (permalink / raw)


i put thjs in my .emacs file and it complains... it only works when it
is set to global-map. It doesnt seem to recognize perl-mode-map....

jonathan

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

* Re: adding perl-mode menu
  2005-02-14  4:13   ` bluj
@ 2005-02-14 13:59     ` Stefan Monnier
  2005-02-15  0:24       ` bluj
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2005-02-14 13:59 UTC (permalink / raw)


> i put this in my .emacs file and it complains...

A good habit is to give too much info.  Much better than too little.
Basically, just assume we're 100% pure idiot.  Just saying "complains" is
not enough.

> it only works when it is set to global-map.  It doesnt seem to recognize
> perl-mode-map....

That's because perl-mode-map is only created when perl-mode is loaded which
only happens when you open a Perl file.

You can do

  (defun my-perl-hook ()
    (define-key perl-mode-map [menu-bar cust]
      (cons "Cust" (make-sparse-keymap "Cust"))))
  (add-hook 'perl-mode-hook 'my-perl-hook)


-- Stefan

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

* Re: adding perl-mode menu
  2005-02-14 13:59     ` Stefan Monnier
@ 2005-02-15  0:24       ` bluj
  0 siblings, 0 replies; 5+ messages in thread
From: bluj @ 2005-02-15  0:24 UTC (permalink / raw)


looks like i am the idiot Stefan ;). 
Thanks very much

jonathan

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

end of thread, other threads:[~2005-02-15  0:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-13 20:54 adding perl-mode menu bluj
2005-02-14  1:42 ` Stefan Monnier
2005-02-14  4:13   ` bluj
2005-02-14 13:59     ` Stefan Monnier
2005-02-15  0:24       ` bluj

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