I have a file (output from a program) that includes VT-100 escape sequences (colors, bold face, etc.). When I open the file in Fundamental mode, the escape sequences appear as are, and are not interpreted. How can display the file with the VT-100 sequences recognized as colors, etc?
Asked
Active
Viewed 316 times
1 Answers
3
See https://unix.stackexchange.com/questions/19494/how-to-colorize-text-in-emacs
For example: put the following in your emacs init file:
(define-derived-mode fundamental-ansi-mode fundamental-mode "fundamental ansi"
"Fundamental mode that understands ansi colors."
(require 'ansi-color)
(ansi-color-apply-on-region (point-min) (point-max)))
then run M-x fundamental-ansi-mode
on the buffer with the escape sequences.

Community
- 1
- 1

Joost Diepenmaat
- 17,633
- 3
- 44
- 53
-
This works mostly well, but it modifies the buffer. That'd be okay for my personal use case, except that I like to hit a random key and then `y` to revert the buffer. Also, auto-revert-mode is probably unusable. Any idea on how to fix these problems? For now I'm adding undo to the list of keystrokes. – interestedparty333 Aug 16 '15 at 14:31
-
Also, I find the following helpful for not having to manually enter fundamental-ansi-mode: (setq auto-mode-alist (cons '("\\.log\\'" . fundamental-ansi-mode) auto-mode-alist)) – interestedparty333 Aug 16 '15 at 14:32