How do I issue M-S-<left-arrow> to Emacs running in iTerm on Mac OS Mavericks?

2

When I press that key combination I hear a bell and see 0D chars printed to the buffer instead of the command bound to that key chord being executed (org-table-delete-column in this case). M-<left-arrow> works fine however.

Having done some digging I think M-<any-arrow> only works because iTerm is configured to send certain hex sequences to the terminal for those keys. When I created a new profile without those bindings all the M-<arrow> keys caused bells and characters to be printed.

So I have a few questions. First of all, what are those hex sequences? What sequences would I need to get M-S-<left-arrow> to be issued correctly? Why doesn’t iTerm have all these already defined? And, lastly, why do we have them at all? Why can’t iTerm just send the keys as they are pressed to the terminal and have them work how they should, with the exception of those key chords needed by iTerm and Mac OS X.

user283914

Posted 2013-12-22T18:48:28.497

Reputation:

Answers

1

Try adding these lines to ~/.emacs:

(define-key input-decode-map "\e[1;10A" [S-M-up])
(define-key input-decode-map "\e[1;10B" [S-M-down])
(define-key input-decode-map "\e[1;10C" [S-M-right])
(define-key input-decode-map "\e[1;10D" [S-M-left])

Use cat -v or C-v in a shell to see the escape sequences.

Lri

Posted 2013-12-22T18:48:28.497

Reputation: 34 501