emacs - [control shift up] doesn't work

前端 未结 3 1933
太阳男子
太阳男子 2020-12-20 03:37

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 wo

相关标签:
3条回答
  • 2020-12-20 03:59

    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.

    0 讨论(0)
  • 2020-12-20 04:06

    This could well be a duplicate of:
    Binding M-<up> / M-<down> in emacs 23.1.1

    If this is the case, Gilles' answer should sort you out (undoubtedly with different escape sequences, though.)

    edit (for better visibility -- see answer below):

    It turned out that gnome terminal does not transmit these key combinations, so the solution relies upon the following: https://superuser.com/questions/230852/get-ubuntu-terminal-to-send-an-escape-sequence-controlshiftup

    0 讨论(0)
  • 2020-12-20 04:12

    Finally, with the help from grawity on superuser.com, I got it working. Please this thread

    https://superuser.com/questions/230852/get-ubuntu-terminal-to-send-an-escape-sequence-controlshiftup

    0 讨论(0)
提交回复
热议问题