How can I apply a color-scheme (.el file) in emacs?
Solution 1
You need to load color-theme and initialize with something like this:
(add-to-list 'load-path "/path/to/color-theme.el/file")
(require 'color-theme)
(load 'zenburn) ;; requires that zenburn.el is in your load path
(eval-after-load "color-theme"
'(progn
(color-theme-initialize)
(color-theme-zenburn)))
If your distribution of emacs doesn't already have color-theme installed, you'll need to download it first from http://www.nongnu.org/color-theme/
Solution 2
Most of your code is boilerplate code from color-theme installation guide so should work fine. Look at the things that are different.
(add-to-list 'load-path "/home/sanoj/")
(require 'color-theme)
(require 'zenburn)
(eval-after-load "color-theme"
'(progn
(color-theme-initialize)
(color-theme-zenburn)))
Your add-to-list must take a DIRECTORY name as an argument, that's your first mistake. Also, you mustn't load zenburn, you must require it.
I just checked it on my emacs 23 on Arch and it works!
Solution 3
I'm an emacs newbie; but with emacs 23.2.1 on Vista, I got this by adding the following lines. I also had to name the file as ~/.emacs.d/zenburn-theme.el.
(require 'color-theme)
(load-theme 'zenburn)
(color-theme-zenburn)
Related videos on Youtube
Comments
-
Jonas over 1 year
I have downloaded zenburn.el that is a color-scheme for Emacs, but I don´t know how I can apply it to emacs. I am a beginner in emacs.
How do I apply my .el file to emacs? Can I do some linking from my
.emacs
-file?I am using emacs23 on Linux Mint 8.
I have now installed color-theme with
sudo apt-get install emacs-goodies-el
But I don't get Zenburn when I start emacs, and there is no Zenburn when I do
M-x color-theme-<TAB> <RETURN>
in emacs.This is my .emacs
(tool-bar-mode -1) (add-to-list 'load-path "/home/sanoj/zenburn.el") (require 'color-theme) (load 'zenburn) ;; requires that zenburn.el is in your load path (eval-after-load "color-theme" '(progn (color-theme-initialize) (color-theme-zenburn)))
-
Doug Harris about 14 yearsDid you change
/path/to/color-theme.el/file
? Did you load zenburn.el? I'll update my answer with an example. -
Doug Harris about 14 yearszendburn.el (with a "d") or zenburn.el (without the "d")? I keep my own local el files in an elisp subdirectory under my home directory. I then have a line like the first one in my example to add
/home/dharris/elisp
to load-path. -
Jonas about 14 yearsSorry I meant
zenburn.el
, and I have listed my.emacs
in my question now. -
Jonas about 14 yearsDo I have to load it with any command or should the colors just be there when I start emacs?
-
Doug Harris about 14 yearsI'm not sure how much more I can help with this since I can't see everything in your set up. Take a look for interesting error messages in the Messages buffer. You might also find some useful stuff on the color theme page on the emacs wiki: emacswiki.org/emacs/ColorTheme
-
Jonas about 14 yearsThanks anyway! I think there is a bug in my elisp, because when I try to save a custom option emacs says: "Cannot save customixations; init file was not fully loaded". See my comment to: superuser.com/questions/127420/…