Tuesday, February 24, 2009

Emacs, Carbon Emacs and color-theme

I don’t like very much standard emacs theme, especially when in “GUI” mode (that is to say Carbon Emacs/Aquamacs if you are on the mac).
Luckily color-theme module does an excellent job. I have a long list of themes ready to be selected. In fact, for nostalgic reasons I like the “Classic” theme.
I wanted this theme to be automatically loaded when I start Emacs. Unfortunately default OS X Emacs does not have color-theme installed (and I don’t mind the way it looks by default in the terminal). So it was only a matter of conditionally branching between GUI emacs and terminal Emacs.
Moreover, I could not use (require ‘color-theme), for this would give error when run in the terminal version. This is my solution:
(defun my-color ()
 (load-library "color-theme")
 (color-theme-initialize)
 (color-theme-classic))
    (if window-system
     (my-color))