Subject: keybinding involving Ctrl and Shift and letter

From: Chong Yidong <[email-masked]>
Date: Wed, 17 Sep 2008 16:08:31 -0400

> i'm trying to set keybindings for both Ctrl+n and Ctrl+Shift+n, by:
>
> (global-set-key (kbd "C-N") 'f1)
> (global-set-key (kbd "C-n") 'f2)
>
> however, that doesn't work.
> Emacs will take both Ctrl+Shift+n and Ctrl+Shift+n to be whichever is  
> evaluated last. In this case, f2.
>
> But the following works:
>
> (global-set-key (kbd "C-S-n") 'f1)
> (global-set-key (kbd "C-n") 'f2)
>
> This seems to contradict with Meta's ways.

This is a legacy of ASCII.  Taking a look at an ASCII chart, you'll see
that ^A (control-a) through ^Z (control-z) map to ASCII codes 1 through
26, and these control keys are not case sensitive: control-a is
equivalent to control-A.

Emacs extends ASCII, which allows us to define things like C-] which are
not present in ASCII.  However, (kbd "C-N") and (kbd "C-n") still both
evaluate to ^N.