6

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)))
Jonas
  • 26,874
  • 52
  • 105
  • 125

4 Answers4

5

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/

Doug Harris
  • 27,333
  • 17
  • 78
  • 105
  • Did you change `/path/to/color-theme.el/file`? Did you load zenburn.el? I'll update my answer with an example. – Doug Harris Apr 08 '10 at 15:05
  • zendburn.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. – Doug Harris Apr 08 '10 at 15:24
  • Sorry I meant `zenburn.el`, and I have listed my `.emacs` in my question now. – Jonas Apr 08 '10 at 15:44
  • Do I have to load it with any command or should the colors just be there when I start emacs? – Jonas Apr 08 '10 at 16:09
  • I'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: http://www.emacswiki.org/emacs/ColorTheme – Doug Harris Apr 08 '10 at 16:30
  • Thanks 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: http://superuser.com/questions/127420/how-can-i-hide-the-tool-bar-in-emacs-persistently/127901#127901 – Jonas Apr 08 '10 at 20:57
1

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)
1

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!

archguest
  • 11
  • 1
0

thanks, doug. i'm running emacs 23 (emacs-snapshot-gtk and emacs-goodies-el .deb packages installed) on ubuntu 10.4. i found if i put the zenburn.el into my .emacs.d directory, i could omit the first line. also, i was getting errors from both the load and color-theme-initialize lines, so with these minor adjustments, your code works perfectly, and i have zenburn. YEAH!!!!! man. what a relief to the eyes. before this, i had been using X commandline parameters, or gnome keyboard shortcuts (windows_key + n) to reverse. but while these reversed the background, they were still too high contrast. so thank you for the last piece in the puzzle!

(require 'color-theme)
(load "~/.emacs.d/zenburn")
(eval-after-load "color-theme"
  '(progn
     (color-theme-zenburn)))