Torus Solutions 改

Emacs の Compilation Mode で ANSI カラーを有効にする

image ➡️ image

Emacs で M-x compile としてユニットテストを走らせたいときとかに、エスケープシーケンスがそのまま表示されて読みづらかった。 しらべてみると ansi-color-for-compilation-mode という変数は初期状態から有効になっていた。 でも、Compilation Mode でそれを有効にするにはフックを追加する必要があった。

In order for this to have any effect, ‘ansi-color-compilation-filter’ must be in ‘compilation-filter-hook’.

このフックは Emacs の Customize では設定できないようだったので .emacs に手動で書き足した。

   (add-hook 'compilation-filter-hook 'ansi-color-compilation-filter)