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

3

9

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?

Proclivity answered 15/10, 2013 at 6:34 Comment(0)
P
7

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.

Proclivity answered 15/10, 2013 at 16:33 Comment(1)
I don't remember now, but I think this might have been the file not being on my load-path. There's more info here about when this sort of an error comes up.Proclivity
S
1

If you are using emacs 24, I think you could change the 4 lines you include by this single line:

(load-theme 'twilight t)

No extra requires; this use the emacs 24 theme approach.

If you are using a recent version of twilight, that should give you no error.

Shiri answered 15/10, 2013 at 6:59 Comment(1)
Try moving the .el file to a directory in your load path. In fact, it would be simpler if you installed that theme via package-install.Shiri
H
0

You say "The color-theme-twilight.el file lives in ~/.emacs.d/themes/." But I don't see where you load that file. Add (require 'color-theme-twilight) to your init file, and make sure color-theme-twilight.el is in your load-path.

Handmedown answered 15/10, 2013 at 15:59 Comment(2)
Tried. Error message: Cannot open load file: color-theme-twilightProclivity
If you put a file named color-them-twilight.el in your load-path, and if you evaluate (require 'color-theme-twilight), and if that file does (provide 'color-theme-twilight), then the file will be loaded. But if the file does no provide then you need to use load-library, load, or load-file to load it, instead of require. If it has provide, but provide gives a different feature name than color-theme-twilight, then your require needs to use that feature name also. Do C-h f for each of the functions I've mentioned, and you will no doubt understand.Handmedown

© 2022 - 2024 — McMap. All rights reserved.