[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Clearing keybindings when redefining a minor mode map
From: |
Elena |
Subject: |
Re: Clearing keybindings when redefining a minor mode map |
Date: |
Mon, 27 Dec 2010 05:58:45 -0800 (PST) |
User-agent: |
G2/1.0 |
On Dec 27, 7:19 am, Leo Alekseyev <dnqu...@gmail.com> wrote:
> Greetings all,
>
> Suppose I have a keybinding that is shared by two minor modes (mode A
> and mode B). I want to accomplish the following: if both modes A and B are
> active, then the keybinding should only invoke mode A's command.
>
> My original approach was to insert code in mode B's commands that checks if
> mode A is active, and if so, it creates a new keymap for mode B, with
> conflicts removed. Unfortunately, even though the new map is created
> properly, it
> doesn't remove the old keybindings that are in conflict with mode A. Is
> there an easy way to clear those keybindings?
>
> --Leo
Maybe you could put some code in mode B's hook to disable mode A if
enabled already and then enable it? This way you would be ensuring
mode A always gets enabled after mode B, thus shadowing mode B's map.