[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: How to override key binding for groovy-mode?
From: |
Drew Adams |
Subject: |
RE: How to override key binding for groovy-mode? |
Date: |
Tue, 8 Sep 2015 11:16:54 -0700 (PDT) |
> What is the general procedure for overriding a key binding set by a package?
>
> I have a global key binding for a function I wrote (using "global-set-key").
> I recently started using "groovy-mode", but I noticed that this mode is
> using my key to bind to something else.
>
> What should I add in my "groovy-mode-hook" to make it use my global binding
> instead? Or is there a "more correct" way to do this?
Look for a `groovy-mode-map', i.e., a keymap that groovy-mode binds its
keys in. It might have a different name. Then use `define-key' to
remove that binding (bind to nil to remove a binding). You can also
use `define-key' to bind the groovy command to some other key in that map.
(define-key groovy-mode-map THE-KEY nil) ; Remove binding
(define-key groovy-mode-map OTHER-KEY THE-GROOVY-COMMAND) ; Move to a diff key