How do you reference the meta and arrow key combinations in emacs init.el?
<p>I am trying to override Meta + left / right arrow keys in my emacs config and cannot figure out how to refer to the key sequence. </p>

<p>If I interact with Emacs directly I can type
"M-x, global-set-key, M-, next-buffer", and it works fine. But I can't figure out how to type this into my init.el file. These are some things that I have tried:</p>

<pre><code>(global-set-key "\M right" 'next-buffer)
(global-set-key "\M &lt;right&gt;" 'next-buffer)
(global-set-key [\M right] 'next-buffer)
(global-set-key [M right] 'next-buffer)
(global-set-key [M-right] 'next-buffer)
(global-set-key (kbd M-&lt;right&gt;) 'next-buffer)
(global-set-key [M (kbd &lt;right&gt;)] 'next-buffer)
</code></pre>

<p>etc.</p>

<p>More Info:</p>

<p>OK, this does work natively: <code>(global-set-key [M-right] 'next-buffer)</code> (thank you) - it's not working on iTerm2 in a VM (minor detail :)
And for that environment: <code>M-x describe-key</code> does not open help but in <code>*Messages*</code> prints: <code>ESC &lt;right&gt; (translated from ESC M-[ C) is undefined</code></p>

<p>And that's why I was confused and was not able to just paste that into kbd.
And that's why I don't think it is being trumped by another mode.</p>