How to fix "Symbol's function definition is void" while loading up a color theme in emacs24?

Indradhanush Gupta picture Indradhanush Gupta · Oct 15, 2013 · Viewed 25.4k times · Source

When I load my .emacs, although the color theme, twilight, loads up fine, but it shows me this error message:

Symbol's function definition is void: color-theme-twilight

In my .emacs I have put the following lines to add the color theme:

(require 'color-theme)
(setq color-theme-is-global t)
(color-theme-initialize)
(color-theme-twilight)

The color-theme-twilight.el file lives in ~/.emacs.d/themes/

I looked at this question. But the solution there is a correction to a typo. But I am not making that typo. I am on emacs24. What is the problem?

Answer

Indradhanush Gupta picture Indradhanush Gupta · Oct 15, 2013

Solved the problem. Removed all the lines :

(require 'color-theme)
(setq color-theme-is-global t)
(color-theme-initialize)
(color-theme-twilight)

And just added:

(load-file "~/.emacs.d/themes/color-theme-twilight.el")

The problem was the last line:

(color-theme-twilight)

Other three lines are not required at all. Not sure if this is the most elegant solution.