emacs (v.26.3) can distinguish, out of the box, C-M-v (scroll-other-window) and C-M-S-v (scroll-other-window-down).

On the other hand, emacs -nw, when run in either gnome-terminal, mate-terminal or xterm, translates C-M-S-v to C-M-v, even when I explicitly set the former.

(Also, as a side note, xterm demands I use ESC rather than the "Alt" key, which is actually "Meta". Bonus question: why?)

Anyone know how I can deal with this?

  • Can your terminal distinguish C-M-v from C-M-S-v outside Emacs? – Drew Jun 9 '20 at 18:02
  • @drew -I'm not sure how to check that. In a pervious question I ran cat at the terminal & checked the output (in that case of M-<arrow>) by typing the key combinations. In this case, on xterm, neither C-M-v nor C-M-S-v produce any output, though emacs does respond to them. On gnome-terminal, I'm not getting something that makes sense to me. C-M-v produces on the terminal "^[^" (without the quotes), but then when I follow it with another key, say "a", the second "^" disappears & I get "^[a". It is true that C-M-S-v produces the same result. – Diagon Jun 10 '20 at 2:39
  • Hopefully someone knowledgeable can help. ^[ is CONTROL-[, which is the ASCII ESCAPE control character (one char, written ^[ sometimes). So ^[^ would be ESC-^ and ^[a would be ESC-a. I'm guessing you need to do something with the terminal itself, but maybe someone will suggest a solution from within Emacs. Otherwise, maybe try googling for escape control sequences and terminal. Maybe this is a start: termsys.demon.co.uk/vtansi.htm. Or this: docs.microsoft.com/en-us/windows/console/… – Drew Jun 10 '20 at 3:18
  • Does this answer your question? How can I use Emacs and iTerm for the same keybinding? – Drew Dec 21 '20 at 22:58
  • Thanks, Drew, but there the conflict is between the OS swallowing the keys before they get to emacs. They never make it that far. Here the keys are not swallowed. Instead, emacs doesn't distinguish two different key combinations. Either the terminal program is doing some translation, oremacs -nw is for some reason ignoring the explicit setting. – Diagon Dec 25 '20 at 0:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.