GNU bug report logs - #966
keybinding involving Ctrl and Shift and letter

Previous Next

Package: emacs;

Reported by: xah lee <xah <at> xahlee.org>

Date: Fri, 12 Sep 2008 03:55:05 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


Message #10 received at 966-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: xah lee <xah <at> xahlee.org>
Cc: 966-done <at> debbugs.gnu.org
Subject: keybinding involving Ctrl and Shift and letter
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.




This bug report was last modified 16 years and 248 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.