R – How to make Emacs (without GUI) differentiate between Ctrl+Shift+S and Ctrl+S

emacskeyboard shortcuts

I'm trying to teach Emacs standard shortcut keys. I use emacs23-nox version from Debian, often through SSH connection. One of those is CTRL+SHIFT+S for SaveAs. The relevant part of configuration looks like this:

    (global-set-key (kbd "C-S") 'write-file)
    (global-set-key (kbd "C-s") 'save-buffer)

but causes either both CTRL+SHIFT+S and CTRL+S invoke 'save-buffer (or 'write-file, depending on which line comes last). I also tried "C-S-s" instead of "C-S".

No Use of Shift Key section of Why Emacs's Keyboard Shortcuts Are Painful says it's not possible. I read this answer, but the accepted solution doesn't work for me (C-h k CTRL+SHIFT+S prints C-s).

Is there a way to make Emacs (the no GUI version) differentiate between CTRL+SHIFT+S and CTRL+S?

Best Answer

You can't, there isn't any provision in the character sets for uppercase control characters. The only way you can get shift and control is by going direct to the windowing system, so you need the GUI version.

Related Topic