0

This question already has an answer here:

I am having problems to configure my EMACS in -nw mode using linux thorough ssh. I am trying to map Ctrl+Shift+z to redo using undo-tree-redo. I tried the following code

(defalias 'redo 'undo-tree-redo)
(global-set-key (kbd "C-z") 'undo)
(global-set-key (kbd "C-S-z") 'redo)  

I also want to map some other key bindings using the Shift key, however, it seems that it is not mapped correctly. I tried to follow this solution Shift+Up isn't recognized by Emacs in a terminal. However when I try to get the escape function to say Ctrl+Shift+z using Ctrl+Q, it returns ^Z, which is exactly the same as whiotu the shift key!!!!

So the Shift key has absolutly no effect on the key binding. The shift key does work though, since I can use it to capitalize etc.

How can I solve this issue?

Note: some other keys also have a weird behaviour when using Ctrl+Q to insert the characters literally. For instance the return key gives ^M and the backspace gives ^?. I have absolutely no idea what's going on!

marked as duplicate by Gilles, Emacs User, Drew, zck, sds Nov 27 '15 at 14:12

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

Correct, C-z and C-S-z are the same when inside of a terminal; the terminal protocol simply provides no way to distinguish between them. The terminal only deals in characters, not keypresses, so there's no way for the other end to know what modifier keys were in use, only what character was generated.

Since I presume you're running Emacs over ssh in order to edit files on the remote host, I recommend that you run Emacs locally instead, and edit the files over ssh using TRAMP mode. Simply type in a remote filename when you open a file: C-x f /user@otherhost:path/to/file RET.

BTW, you can figure out what's going on by looking at a chart of the ASCII control codes. C-q RET produces ^M because that's the carriage return character, and C-q DEL produces ^? because that's the delete character. They're displayed as ^M and ^? because they're not normally displayed at all.

  • Using TRAMP mode works like a charm! Thank you! – Jemme Dec 10 '15 at 14:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.