Frage

I've created a custom key binding macro as follows:

(global-set-key (kbd "C-C C-c") "\C-a\C- \C-n\M-w\C-y")

The problem is that C-c C-c is defined for python-send-buffer in python-mode. So my macro works for all modes except python-mode. I am assuming that python-mode is evaluated after my init file, so it overwrites that keybinding.

I tried unsetting C-c C-c using (eval-after-load "python-mode") and using global-unset-key but that doesn't work. C-c C-c in python is always mapping to python-send-buffer.

How can I completely disable Python's C-c C-c, and use my macro instead?

I am using Emacs 24.2.1.

War es hilfreich?

Lösung

(add-hook 'python-mode-hook
          (lambda()
            (local-unset-key (kbd "C-c C-c"))))

Andere Tipps

This should do it:

(add-hook 'python-mode-hook
          (lambda()
            (define-key python-mode-map (kbd "C-c C-c") nil)))
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top