Have you met the case that Emacs in iterm2 on Mac does not recognize M-S-RET (Meta(Option)+Shift+ Return key)? I guess it's related to the modifier key conversions in terminals.

M-S-RET is used in org-mode

I tried describe-key in Emacs and got M-[1 3; 4 I think M stands for meta, 13 is the ASCII code of return, 4 is the CSI u code for Shift+Alt see http://www.leonerd.org.uk/hacks/fixterms/

  • You might want to clarify what what describe-key says, because the spacing in your M-[1 3; 4 looks wrong. Also to see the full sequence of chars received by Emacs when you press M-S-RET view-lossage (aka C-h l) is a better choice (describe-key will try to guess when the sequence ends and that guess is not always the one you need). – Stefan Mar 17 at 12:24
  • When testing in iTerm2, I've set up the left option key (Mac) to be Esc+, and report modifier CSI u key. In Option set sa Normal, M-S-RET is always equal to M-RET in terminal. I've tried to Use C-h l, it says ; – jing chen Mar 31 at 1:54
  • I've tried to Use C-h l, it says ESC [ 1 3 ; 4 [nil] – jing chen Mar 31 at 2:01
  • What happens if you put (define-key input-decode-map (kbd "ESC [ 1 3 ; 4") (kbd "S-RET")) – Stefan Mar 31 at 2:52
  • Thank you very much! It works. – jing chen Mar 31 at 3:26