49.3.7 Modifier Keys
The default key bindings in Emacs are set up so that modified alphabetical characters are case-insensitive. In other words, C-A
does the same thing as C-a
, and M-A
does the same thing as M-a
. This concerns only alphabetical characters, and does not apply to shifted versions of other keys; for instance, C-@
is not the same as C-2
.
A Control
-modified alphabetical character is generally considered case-insensitive: Emacs always treats C-A
as C-a
, C-B
as C-b
, and so forth. The reason for this is historical: In non-graphical environments there is no distinction between those keystrokes. However, you can bind shifted Control
alphabetical keystrokes in GUI frames:
(global-set-key (kbd "C-S-n") #'previous-line)
For all other modifiers, you can make the modified alphabetical characters case-sensitive (even on non-graphical frames) when you customize Emacs. For instance, you could make M-a
and M-A
run different commands.
Although only the Control
and Meta
modifier keys are commonly used, Emacs supports three other modifier keys. These are called Super
, Hyper
, and Alt
. Few terminals provide ways to use these modifiers; the key labeled Alt
on most keyboards usually issues the Meta
modifier, not Alt
. The standard key bindings in Emacs do not include any characters with the Super
and Hyper
modifiers, and only a small number of standard key bindings use Alt
. However, you can customize Emacs to assign meanings to key bindings that use these modifiers. The modifier bits are labeled as ‘s-
’, ‘H-
’ and ‘A-
’ respectively.
Even if your keyboard lacks these additional modifier keys, you can enter it using C-x @
: C-x @ h
adds the Hyper flag to the next character, C-x @ s
adds the Super flag, and C-x @ a
adds the Alt flag. For instance, C-x @ h C-a
is a way to enter Hyper-Control-a
. (Unfortunately, there is no way to add two modifiers by using C-x @
twice for the same character, because the first one goes to work on the C-x
.)