[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Can one define global-set-key to override mode-based keymap?
From: |
martin rudalics |
Subject: |
Re: Can one define global-set-key to override mode-based keymap? |
Date: |
Thu, 21 Dec 2006 14:17:39 +0100 |
User-agent: |
Mozilla Thunderbird 1.0 (Windows/20041206) |
>> Not really recommended:
>>
>> (defvar my-map (make-sparse-keymap)
>> "My keymap.")
>>
>> (defvar my-map-alist `((t . ,my-map))
>> "My keymap alist.")
>>
>> (add-to-ordered-list 'emulation-mode-map-alists 'my-map-alist 100)
>>
>> (define-key my-map [(control n)] 'other-window)
>
> I tried this and it works great so far. Why is it not recommended?
It might interact badly with other modes using this - like cua-mode.
If you use them, you should study their keymaps in order to avoid any
bad interactions. Alternatively you could try `overriding-local-map'.