Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
130 views
in Technique[技术] by (71.8m points)

emacs23 - emacs - [control shift up] doesn't work

I tried to define hotkey as following

(global-set-key [(control shift up)] 'other-window)

but it doesn't work (no error, just doesn't work), neither does

(global-set-key [(control shift down)] 'other-window)

But

(global-set-key [(control shift right)] 'other-window) 

and

(global-set-key [(control shift left)] 'other-window)

work!

But because the last two key combinations are used by emacs (as default), I don't wanna change them for other functions.

So how could I make control-shift-up and control-shift-down work?

I have googled "(control shift up)", it seems that control-shift-up is used by other people, (but not very few results).

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The reason for this is not an Emacs problem, but comes from the fact that your terminal cannot produce a key sequence for C-S-up.

You can verify this very easily. Open a terminal and then type:

Control-v Control-Shift-right

The Control-v part will make the control sequence for the next key be inserted verbatim into your shell. In our case, it will insert the sequence for Control-Shift right, and that'll look something like this:

^[[1;6C

Now, try the same thing for C-S-up:

Control-v Control-Shift-up

You'll see that no control sequence is entered, which hints at the fact that when you press C-S-up in Emacs, it will actually never receive anything, because the terminal is not able to produce anything to pass on to Emacs.

We can double-verify this if you just start a new emacs -nw and type C-h k to invoke Emacs' describe-key function. You'll get asked in the minibuffer to type a key to see what function it is bound to. If you now type C-S-up nothing happens - of course not, since the terminal in which your Emacs runs doesn't produce anything.

However, if you're just looking for an unused key-combination, how about just Shift-up (or even Shift-right) without Control? That one should work both in a terminal emacs and in the windowed version.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...