[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (global-set-key) vs (define-key)
From: |
Michael Heerdegen |
Subject: |
Re: (global-set-key) vs (define-key) |
Date: |
Thu, 25 Jun 2015 21:11:32 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Daniel Corbe <corbe@corbe.net> writes:
> I have a suspicion that (define-key) is not allowed to override global
> bindings. Is that true? If so, what should I be using instead?
What do you mean with "global-bindings"? Probably not bindings in
`global-map', because `define-key' can of course bind keys in
`global-map'.
> (define-derived-mode router-mode eshell-mode "Router"
> "Some key bindings and tools to make dealing with routers/switches
> easier."
>
> (define-key eshell-mode-map "?" 'router-mode-help-key)
> (define-key eshell-mode-map (kbd "C-z") 'router-mode-end-key)
> (define-key eshell-mode-map (kbd "TAB") 'self-insert-command))
This will modify `eshell-mode-map', the map used by eshell-mode. This
is probably not what you want. Better use a separate map, it set
`eshell-mode-map' as parent map to inherit from it.
Michael.