I'm looking to configure iterm2 to output the correct hexcodes that correspond to in emacs.

There's a whole bunch of mappings predefined but it's very cryptic.

enter image description here

I'm a little bit lost as to how these mappings are translated and if there is a table of how these mappings work.


I could post a thousand-word essay on how all of the various layers of software interact to provide both backwards-compatibility with hundreds of historical systems as well as customizability for dealing with new ones, but the truth is that it's really a waste of time. Just run Emacs as a normal gui application, and it'll all work much better.

If you really insist on running Emacs inside a terminal emulator, know that the OS tells the terminal emulator directly what keys you pressed. then the terminal emulator then translates this into a sequence of bytes to send to the application running inside the terminal, and finally that application translates it back into some idea of what keys you pressed.

The idea behind this configuration window in iTerm is to allow you to tell iTerm what the application you're running expects. Unfortunately, Emacs can be configured to work in a wide variety of environments, and you haven't given us enough information to figure all of that out.

I would suggest using the Emacs help functions to tell you what Emacs thinks is going on. Specifically, if you type C-h k, followed by any keyboard shortcut, Emacs will tell you what keys Emacs thinks you pressed and what command they normally trigger, if any. This will tell you what Emacs thinks of the bytes or escape codes that iTerm is sending.

  • what sort of information do I need to give in order to figure it out? – zcaudate Sep 25 '18 at 5:09
  • You need to know what OS Emacs is running on (you might be running it on another computer, and having it show up in the terminal on this one), what your TERM environment variable is set to in the shell where Emacs is running, what's in the terminfo database for that terminal type, and how Emacs is configured. And maybe other things. – db48x Sep 30 '18 at 21:58

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.