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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 966 in the body.
You can then email your comments to 966 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#966; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to xah lee <xah <at> xahlee.org>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: xah lee <xah <at> xahlee.org>
To: bug-gnu-emacs <at> gnu.org
Subject: keybinding involving Ctrl and Shift and letter
Date: Thu, 11 Sep 2008 20:46:22 -0700
This seems to be a bug.

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. That is (kbd "M-N") works  
but not (kbd "M-S-n").

  Xah
∑ http://xahlee.org/

☄

In GNU Emacs 22.2.1 (powerpc-apple-darwin8.11.0, Carbon Version 1.6.0)
 of 2008-04-05 on g5.tokyo.stp.isas.jaxa.jp
Windowing system distributor `Apple Inc.', version 10.4.11
configured using `configure  '--prefix=/Applications/Emacs.app/ 
Contents/Resources' '--with-carbon' '--without-x' '--libexecdir=/ 
Volumes/Emacs/Emacs.app/Contents/MacOS/libexec' 'CFLAGS=-Os -arch  
i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -DUSE_ATSUI - 
DUSE_MAC_TSM''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  locale-coding-system: iso-8859-1
  default-enable-multibyte-characters: t



☄







Reply sent to Chong Yidong <cyd <at> stupidchicken.com>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to xah lee <xah <at> xahlee.org>:
bug acknowledged by developer. Full text and rfc822 format available.

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.




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

From: xah lee <xah <at> xahlee.org>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 966-done <at> debbugs.gnu.org
Subject: Re: keybinding involving Ctrl and Shift and letter
Date: Wed, 17 Sep 2008 15:48:00 -0700
umm...

thanks for the answer.

I think there is still a problem, that is, inconsistency with the  
meta notation.

Namely, when defining a key with Ctrl or Meta with a Shift and a  
letter, when it is Meta,

(global-set-key (kbd "M-N") 'f)
works but
(global-set-key (kbd "M-S-n") 'f) does not work.

But with Ctrl, it is the the other way around.

Shouldn't emacs make "M-S-n" notation work and not "M-N", so that it  
is consistant with the Control?

In summary, the notation for a Meta/Control+Shift+‹letter›  
keybinding used in macro is not consistant. For Meta, "-N" is  
effective but for Control, "-S-n" is effective.

  Xah
∑ http://xahlee.org/

☄


On Sep 17, 2008, at 1:08 PM, Chong Yidong wrote:

> 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.

☄






bug archived. Request was from Debbugs Internal Request <don <at> donarmstrong.com> to internal_control <at> emacsbugs.donarmstrong.com. (Thu, 16 Oct 2008 14:24:03 GMT) Full text and rfc822 format available.

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

Previous Next


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