Add wtk_ansi-color.el to .emacs (*.col support).
authorW. Trevor King <wking@drexel.edu>
Tue, 6 Dec 2011 05:30:10 +0000 (00:30 -0500)
committerW. Trevor King <wking@drexel.edu>
Tue, 6 Dec 2011 05:30:10 +0000 (00:30 -0500)
src/.emacs
src/.emacs.d/load/wtk_ansi-color.el [new file with mode: 0644]

index 9a9c77349864e121443cac74fcfb7afc48b938d8..739811ebecf0f9c9760adb1da994990fa24e9d90 100644 (file)
@@ -17,6 +17,7 @@
 (load "wtk_epa.el")
 (load "wtk_org.el")
 (load "wtk_no-vc.el")
+(load "wtk_ansi-color.el")
 
 (require 'cython-mode)
 
diff --git a/src/.emacs.d/load/wtk_ansi-color.el b/src/.emacs.d/load/wtk_ansi-color.el
new file mode 100644 (file)
index 0000000..96ab681
--- /dev/null
@@ -0,0 +1,16 @@
+; event_jr
+; http://unix.stackexchange.com/questions/19494/how-to-colorize-text-in-emacs
+
+(defun ansi-color-apply-on-region-int (beg end)
+       "apply ANSI colors to the selected region (interactive version)"
+       (interactive "r")
+       (ansi-color-apply-on-region beg end))
+
+(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)))
+
+; associate fundamental-ansi-mode with *.col files
+(setq auto-mode-alist
+       (cons '("\\.col\\'" . fundamental-ansi-mode) auto-mode-alist))