Copy from terminal (tmux) to emacs with color?

I'm currently started using tmux because of getting tired of term-mode, and I managed to shortcut in tmux to open current session output in emacs so I could search and select from it in emacs. I have the only problem - I wish for emacs buffer to display term session output with the same color highlighting - for directories to be blue e.g. As I understand it is doable since term-mode is able of that somehow. Can anyone point me how to copy text with such face overlays from terminal to emacs?

• Are you using tmux in a terminal emulator outside Emacs or in term inside Emacs? – wvxvw Nov 13 '16 at 8:23
• in a terminal emulator outside. – sandric Nov 13 '16 at 16:37
• Does it show the output in any color at all, or is it all the same color? Typically, in terminal, colors are achieved by inserting so-called VT100 codes. In Emacs they are normally interpreted by something like comint-mode, but not necessary map to the same colors you'd see in a different terminal. Usually, your color scheme is responsible for the exact values of those colors. – wvxvw Nov 13 '16 at 20:16
• no color at all - right now I just copy from tmux with tmux save-buffer command. It just copies the text of tmux buffer. So my question is how to copy text with those keycodes and make emacs display colors, even if not matched precisely maybe. – sandric Nov 13 '16 at 21:50
• Ah, ok, now I understand... well, I'm sorry, I don't know. My guess is that you need to look in tmux documentation for clipboard formats it supports. If it could put vt100 codes in clipboard, you could achieve what you want. – wvxvw Nov 14 '16 at 9:33

(require 'ansi-color)

bind H capture-pane -e \; save-buffer ~/tmux.hardcopy \; delete-buffer