[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Customising the menu for python-mode
From: |
Nikolaj Schumacher |
Subject: |
Re: Customising the menu for python-mode |
Date: |
Mon, 18 May 2009 12:05:00 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.93 (darwin) |
Chris Withers <chris@simplistix.co.uk> wrote:
> ;; menu items
> (defvar chris-mode-map
> (let ((map (make-sparse-keymap)))
> (easy-menu-define python-menu map "Python Mode menu"
> `("Python"
> :help "Python-specific Features"
> "-"
> ["Comment" python-shift-left :active mark-active
> :help "Comment"]
> ["Uncomment" python-shift-right :active mark-active
> :help "Uncomment"]))
> map))
>
> Which, while it doesn't error, also does nothing.
>
> What am I doing wrong?
Nothing wrong, just not enough. You've defined a keymap, but you also
need to activate it.
You can do it like this:
(define-minor-mode chris-mode
"my menu mode"
nil nil chris-mode-map)
And then enable `chris-mode'.
Of course you can also modify python-mode-map (or whatever it is called)
instead of creating your own map, so python-mode will take care of
activating the map.
regards,
Nikolaj Schumacher