unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: help-gnu-emacs@gnu.org
Subject: Re: (global-set-key) vs (define-key)
Date: Thu, 25 Jun 2015 21:11:32 +0200	[thread overview]
Message-ID: <87vbeba9i3.fsf@web.de> (raw)
In-Reply-To: 87wpyr3bqr.fsf@corbe.net

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.




  parent reply	other threads:[~2015-06-25 19:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-25 18:05 (global-set-key) vs (define-key) Daniel Corbe
2015-06-25 18:14 ` Drew Adams
2015-06-25 19:11 ` Michael Heerdegen [this message]
     [not found] ` <mailman.5675.1435259510.904.help-gnu-emacs@gnu.org>
2015-06-25 20:28   ` Daniel Corbe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vbeba9i3.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).