If you are talking about binding keys for your own use, then this is the rule: You can bind any keys you like.
If you want to be sure not to bind a key that might already be bound then use C-c
followed by a letter. All such keys are reserved for users (see next).
If you are talking about binding keys in code (e.g., a library) that you write, for use by others, then the rules (conventions) are described here: node Key Binding Conventions of the Elisp manual.
The main rules there, related to what you ask, are those regarding C-c
:
Don’t define C-c LETTER
as a key in Lisp programs. Sequences
consisting of C-c
and a letter (either upper or lower case) are
reserved for users; they are the only sequences reserved for
users, so do not block them.
Sequences consisting of C-c
followed by a control character or a
digit are reserved for major modes.
Sequences consisting of C-c
followed by {
, }
, <
, >
, :
or ;
are also reserved for major modes.
Sequences consisting of C-c
followed by any other ASCII
punctuation or symbol character are allocated for minor modes.
Using them in a major mode is not absolutely prohibited, but if you
do that, the major mode binding may be shadowed from time to time
by minor modes.
You'll note that there is no convention regarding C-x
. An unstated convention, or just good advice/practice is this one, however: If you replace some existing, standard Emacs binding (i.e., one that you get from Emacs as distributed, without loading any 3rd-party libraries) then that might confuse or annoy some users of your code.
You can get to that doc within Emacs, this way:
C-h i
, to open Info, the doc browser.
m el TAB RET
, for menu elisp (TAB
to complete), or just click the Elisp
link with your mouse.
key bi TAB
, then n TAB RET
to complete to Key Binding Conventions
.
Or you can use i
within the Elisp manual, to complete index entries:
C-h i m el TAB RET
.
i key bi TAB
, which completes to key binding
and shows you two possibilities: key binding
and key binding, conventions for
. Type , TAB
to complete to the second, then RET
to accept it.