Wednesday, March 26, 2008

Customizing colors in comint package in Emacs

The default foreground of prompt (gdb, shell, etc.) in the comint package in Emacs is blue. If you are working in PuTTY, the default background is black. Imagine blue on black background. Looks nasty!

You can customize the color of the prompt by using the comint-highlight-prompt variable. For e.g. I am using yellow foreground in my system. Here is how I have customized it by adding these lines in my ~/.emacs:
(copy-face 'default 'comint-highlight-prompt)
(set-face-foreground 'comint-highlight-prompt "yellow")

In short, the first lines creates a font-face variable by copying the default face and the second line changes the foreground value of that font-face variable to "yellow".

Scott A. Kuhl's .emacs file helped me a lot in understanding how to customize this. Thanks to him.

No comments: