I want to set key binding for C-c C-n rather than C-c n. Is it possible?

(global-set-key (kbd "C-x C-s") 'func) ;; Works
(global-set-key (kbd "C-c n")   'func) ;; Works
(global-set-key (kbd "C-c C-n") 'func) ;; Does not do anything :-(

2 Answers 2


You are successfully binding C-c C-n in the global keymap, which is the lowest-priority keymap.

Some major mode binding will be taking precedence, as:

Sequences consisting of ‘C-c’ followed by a control character or a digit are reserved for major modes.

-- C-hig (elisp)Key Binding Conventions

I strongly recommend reading this article in full. It should clarify many things for you.

See also https://stackoverflow.com/questions/683425/globally-override-key-binding-in-emacs.

  • My init file get so long and caos. I get lost what is what, what I added before. I know basics of Python, C, C++. But its really a different structure for me to understand emacs's code. I will definetly read the full article, thank your for the helpful guide.
    – alper
    Jun 30, 2020 at 10:32
  • Good catch elips overwrites it C-c C-n runs the command flycheck-or-norm-next-error. Can I unbind it in order to overwrite? I did (global-set-key (kbd "C-c C-n") nil) but it did not helped :-(
    – alper
    Jun 30, 2020 at 10:41
  • I have tried this and seems like it solved my problem Globally override key binding in Emacs(stackoverflow.com/a/683575/2402577). Maybe I should carry all my keybindings into this function .
    – alper
    Jun 30, 2020 at 10:46

One of two things could be happening. Perhaps something in your config is already bound to C-c C-n that overrides your definition; this is unlikely but you could test for this using describe-key (type C-h k and then C-c C-n at the prompt). Otherwise something in your config is using a keybinding that starts with C-c C-n but is longer. Type C-c C-n ? which will tell you what these longer sequences are and what is bound to them. You have to decide whether to unbind these or use a different sequence from C-c C-n for the function you wish to bind.

  • Its says: C-c C-n runs the command flycheck-or-norm-next-error Can I unlink it in order to overwrite into C-c n. I overwrite it using the solution here: stackoverflow.com/a/683575/2402577
    – alper
    Jun 30, 2020 at 11:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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