unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* keybinding with shift key syntax. C-S-n vs C-N
@ 2008-09-15  9:59 Xah
  2008-09-15 19:44 ` Oleksandr Gavenko
  0 siblings, 1 reply; 5+ messages in thread
From: Xah @ 2008-09-15  9:59 UTC (permalink / raw)
  To: help-gnu-emacs

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

I filed a bug but no response. Can anyone reproduce this?

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: keybinding with shift key syntax. C-S-n vs C-N
  2008-09-15  9:59 keybinding with shift key syntax. C-S-n vs C-N Xah
@ 2008-09-15 19:44 ` Oleksandr Gavenko
  2008-09-16 19:35   ` Xah
  0 siblings, 1 reply; 5+ messages in thread
From: Oleksandr Gavenko @ 2008-09-15 19:44 UTC (permalink / raw)
  To: help-gnu-emacs

I try all write. Same behavior
(GNU Emacs 22.1.1 (i386-mingw-nt5.1.2600) of 2007-06-02 on RELEASE).

(global-set-key (kbd "M-S-n") 'f1) do not define key binding, but
(global-set-key (kbd "M-n") 'f2) do for both M-n and M-N.

In my research I found that C-h k M-M take line
M-k (_translated_ from M-K) runs the command kill-sentence
while C-h k M-m
M-m runs the command back-to-indentation.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: keybinding with shift key syntax. C-S-n vs C-N
  2008-09-15 19:44 ` Oleksandr Gavenko
@ 2008-09-16 19:35   ` Xah
  2008-09-17 15:52     ` B. T. Raven
  2008-09-17 22:51     ` Xah
  0 siblings, 2 replies; 5+ messages in thread
From: Xah @ 2008-09-16 19:35 UTC (permalink / raw)
  To: help-gnu-emacs

On Sep 15, 12:44 pm, Oleksandr Gavenko <gaven...@gmail.com> wrote:
> I try all write. Same behavior
> (GNU Emacs 22.1.1 (i386-mingw-nt5.1.2600) of 2007-06-02 on RELEASE).
>
> (global-set-key (kbd "M-S-n") 'f1) do not define key binding, but
> (global-set-key (kbd "M-n") 'f2) do for both M-n and M-N.

I might have miscommunicated. I try again:

I want to define a keybinding with the Shift down. e.g. Ctrl+Shift+n.

In emacs, it appears there are 2 notations that can be used.

1. (kbd "C-S-n")
2. (kbd "C-N")

however, this does not seems to work property.

  Xah
∑ http://xahlee.org/

☄

---------------------

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

I filed a bug but no response. Can anyone reproduce this?

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: keybinding with shift key syntax. C-S-n vs C-N
  2008-09-16 19:35   ` Xah
@ 2008-09-17 15:52     ` B. T. Raven
  2008-09-17 22:51     ` Xah
  1 sibling, 0 replies; 5+ messages in thread
From: B. T. Raven @ 2008-09-17 15:52 UTC (permalink / raw)
  To: help-gnu-emacs

Xah wrote:
> On Sep 15, 12:44 pm, Oleksandr Gavenko <gaven...@gmail.com> wrote:
>> I try all write. Same behavior
>> (GNU Emacs 22.1.1 (i386-mingw-nt5.1.2600) of 2007-06-02 on RELEASE).
>>
>> (global-set-key (kbd "M-S-n") 'f1) do not define key binding, but
>> (global-set-key (kbd "M-n") 'f2) do for both M-n and M-N.
> 
> I might have miscommunicated. I try again:
> 
> I want to define a keybinding with the Shift down. e.g. Ctrl+Shift+n.
> 
> In emacs, it appears there are 2 notations that can be used.
> 
> 1. (kbd "C-S-n")
> 2. (kbd "C-N")
> 
> however, this does not seems to work property.
> 
>   Xah
> ∑ http://xahlee.org/
> 
> ☄
> 
> ---------------------
> 
> 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").
> 
> I filed a bug but no response. Can anyone reproduce this?
> 
>   Xah
> ∑ http://xahlee.org/
> ☄

Vector notation also works reliably, at least in version 22. I have this 
in my .emacs:

(global-set-key [(control f)] 'find-function-at-point)
(global-set-key [(shift control f)] 'find-variable-at-point)


Ed


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: keybinding with shift key syntax. C-S-n vs C-N
  2008-09-16 19:35   ` Xah
  2008-09-17 15:52     ` B. T. Raven
@ 2008-09-17 22:51     ` Xah
  1 sibling, 0 replies; 5+ messages in thread
From: Xah @ 2008-09-17 22:51 UTC (permalink / raw)
  To: help-gnu-emacs

A emacs developer Chong Yidong replied to my bug report.

Chong wrote:

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

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 16, 12:35 pm, Xah <xah...@gmail.com> wrote:
> On Sep 15, 12:44 pm, Oleksandr Gavenko <gaven...@gmail.com> wrote:
>
> > I try all write. Same behavior
> > (GNU Emacs 22.1.1 (i386-mingw-nt5.1.2600) of 2007-06-02 on RELEASE).
>
> > (global-set-key (kbd "M-S-n") 'f1) do not define key binding, but
> > (global-set-key (kbd "M-n") 'f2) do for both M-n and M-N.
>
> I might have miscommunicated. I try again:
>
> I want to define a keybinding with the Shift down. e.g. Ctrl+Shift+n.
>
> In emacs, it appears there are 2 notations that can be used.
>
> 1. (kbd "C-S-n")
> 2. (kbd "C-N")
>
> however, this does not seems to work property.
>
>  Xah
> ∑http://xahlee.org/
>
> ☄
>
> ---------------------
>
> 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").
>
> I filed a bug but no response. Can anyone reproduce this?
>
>  Xah
> ∑http://xahlee.org/
> ☄



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-09-17 22:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-15  9:59 keybinding with shift key syntax. C-S-n vs C-N Xah
2008-09-15 19:44 ` Oleksandr Gavenko
2008-09-16 19:35   ` Xah
2008-09-17 15:52     ` B. T. Raven
2008-09-17 22:51     ` Xah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).