I am trying to remap globally C-/ but the undo-tree package hinders me from doing so. When calling this command (in my init file):

(global-set-key (kbd "C-/") 'left-char)

after having loaded undo-tree (of course), the binding still refers to the undo command.

Any ideas on how to override undo-tree's pervasiveness?

  • 3
    Related: How to override major mode bindings Commented Oct 24, 2014 at 3:18
  • @kaushalmodi: +1 - My crystal ball tells me that's probably all that is involved here.
    – Drew
    Commented Oct 24, 2014 at 4:29
  • @kaushalmodi Thanks. That was the solution. If you pose it as such, I will be glad to approve it.
    – NVaughan
    Commented Oct 24, 2014 at 15:05

3 Answers 3


You solution can be achieved in one of the two ways:

  • You define your own minor mode whose key-bindings overrides the bindings set by all other minor/major modes.
  • You set that particular key-binding in that minor/major mode to nil.

These solutions can be implemented in multiple ways and they have been presented in detail in these Emacs SE and SO posts:

  • Thanks. I use the bind-key.el solution, as directly creating a minor mode seemed too difficult.
    – NVaughan
    Commented Oct 24, 2014 at 15:50

You can try this, if you want to remap all keys bound to undo-tree-undo.

 (global-set-key [remap undo-tree-undo] 'left-char)

You can also try making your binding in undo-tree-mode-map, assuming that is what is used by undo-tree-mode:

(add-hook 'undo-tree-mode-hook
          (lambda () (define-key undo-tree-map (kbd "C-/") 'left-char)))

(Usually there is a keymap [mode-name]-map like undo-tree-mode-map. In this case the name is actually undo-tree-map.)

  • Thanks. But I really not want either to lose all other bindings to the undo command, or to map them to my other command.
    – NVaughan
    Commented Oct 24, 2014 at 15:07
  • Do you need the hook? Or could you just modify the map once and for all?
    – nispio
    Commented Oct 24, 2014 at 15:45
  • 1
    @nispio: You don't need the hook if the library has already been loaded. If it has not been loaded then presumably undo-tree-mode-map is not yet defined (unbound variable).
    – Drew
    Commented Oct 24, 2014 at 15:54
  • @NVaughan: That's why I mentioned the second possibility: just bind that one key, C-/, and only do so on undo-tree-mode-map.
    – Drew
    Commented Oct 24, 2014 at 15:55

I guess you're using Emacs under terminal? Check C-h k C-/ to see what it is.

In my case, when pressing C-/ in terminal, it actually invokes C-_.

  • Not using it on terminal. And I get the following: "C-/ runs the command undo-tree-undo, which is an interactive compiled Lisp function in `undo-tree.el'. It is bound to C-_, C-/, C-z, <menu-bar> <edit> <undo>, <undo>."
    – NVaughan
    Commented Oct 24, 2014 at 3:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.