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.
C-c
followed by a control key (such asC-c
) is "reserved for major modes", meaning that Lisp code that defines a major mode is entitled to use it (and they often do useC-c C-c
, as ScottFrazer said). Users are still entitled to bind such a key, of course, but just know that major modes will feel free to do so also, so you might need to then find a replacement key to use for such modes (see the answers here for that). See the Elisp manual, nodeKey Binding Conventions
. – Anorakadd-hook
, but the OP states that they usedadd-hook
and it did not work. Marking this question as a duplicate of that question is misleading. The answers for that question do not work in my case, which is why I posted this question. – AdrastusC-x
for this. There are still plenty of keys available to you. See the manual,Key Binding Conventions
for which keys are reserved for users. (And you can also bind any other keys, but they might override mode keys etc.) And you can define your own prefix keys: e.g., you can make<f8>
be a prefix for some or all of your own keys. – Anorak