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?
1 Answer
I found answer by my own - part of rendering ansi color codes in emacs originally answered here, I will double it here:
(require 'ansi-color)
(defun display-ansi-colors ()
(interactive)
(ansi-color-apply-on-region (point-min) (point-max)))
As for copying tmux buffer to with ansi codes for color - also was already answered here, and it here also:
bind H capture-pane -e \; save-buffer ~/tmux.hardcopy \; delete-buffer
term
inside Emacs?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.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.