all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* (global-set-key) vs (define-key)
@ 2015-06-25 18:05 Daniel Corbe
  2015-06-25 18:14 ` Drew Adams
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Daniel Corbe @ 2015-06-25 18:05 UTC (permalink / raw)
  To: help-gnu-emacs


I'm trying to extend eshell so I can use it to manage routers and
switches.  This necessitates changing a few important key-bindings that
equipment manufacturers tend to use.

The problem with the code below is ? works; however, both Ctrl-Z and TAB
stay bound to their original key bindings.

If I use global-set-key instead, TAB and Ctrl-Z do what they're supposed
to do.

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?

(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))

(defun router-mode-help-key ()
  "Defines what happens when a user hits the ? key."
  (interactive)
  (insert "?")
  (eshell-send-input nil nil t))

(defun router-mode-end-key ()
  "This sends Ctrl-Z along to the shell."
  (interactive)
  (eshell-kill-input)
  (insert "end")
  (eshell-send-input))



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-25 20:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
     [not found] ` <mailman.5675.1435259510.904.help-gnu-emacs@gnu.org>
2015-06-25 20:28   ` Daniel Corbe

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.