Search code examples
emacskey-bindingsemacs23

Disabling minor mode key bindings


I asked a question here, and got good responses, but the problem turned out to be different from what I had thought.

I am trying to assign a certain function to the key "C-c" in shell mode, but it seems that a minor mode called tabbar-mode has a prefix-key assigned to "C-c", which overrides my setting for shell mode. How can I disable tabbar mode key assignments?

I put these after (require 'tabbar), but they did not work:

(defvar tabbar-mode-map nil)
(defvar tabbar-prefix-key nil)

Solution

  • (defvar) only initialises a variable if it has no value. See C-hfdefvarRET for details.

    Use (setq) to change the value of an existing variable.

    To prevent the mode's keymap from being used when looking up key-bindings, you can delete it from the minor-mode-map-alist variable:

    (assq-delete-all 'tabbar-mode minor-mode-map-alist)