0

I always was apprehensive about defining custom keybindings because it's so easy to run into conflicts. And lo, when I finally bound org-agenda because it's just too useful not to have it bound, I run into conflict with c++-mode a day later.

Is there such a thing as reserved combination of keys to use as a prefix for user-specified bindings or are we forced to play roulette with every key-binding that starts C-c?

  • Before anyone comments, this is not a duplicate of https://emacs.stackexchange.com/questions/27926/avoiding-overwriting-global-key-bindings. Despite having the same answer, the problems in question are different - here I ask about avoiding my keybindings being overridden by local keybindings from modes, the other poster wanted to avoid overriding global keybindings. It's better for searchability to have both questions on the site, depending on which one of those problems user is trying to solve. – Reverent Lapwing Mar 24 '24 at 14:10
  • FYI it's more a duplicate of https://stackoverflow.com/questions/1144424/are-there-any-emacs-key-combinations-reserved-for-custom-commands (but StackExchange doesn't permit cross-site duplicates). – phils Mar 24 '24 at 22:45

1 Answers1

1

I managed to find the answer myself before posting but this question doesn't appear to be on this site so I'm posting it together with an answer

According to GNU manual on Emacs Lisp, by convention all C-c <letter> keybindings, as well as function keys F5..F9 (without modifier keys), are reserved for user use and binding those keys in packages is frowned upon. So there is very good chance that no matter what packages you have installed and what mode you are using, those bindings will be free to use.

https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html

phils
  • 50,977
  • 3
  • 79
  • 122
  • And if you ever do encounter a package which is binding such a sequence, please raise it as a bug report. – phils Mar 24 '24 at 22:39
  • 1
    Please note carefully that it's not C-c <char> but rather C-c <letter>. (I.e. ascii letters a-z and A-Z along with non-ascii letters from other char sets). Letters are characters, but characters may be many other things besides letters. I've edited the answer accordingly. – phils Mar 24 '24 at 23:14