5

I am on Mac 10.9.5 using Emacs 24.4

Following the instruction in here: https://github.com/sellout/emacs-color-theme-solarized , I downloaded the emacs-color-theme-solarized directory and added it to my Emacs custom-theme-load-path. That directory (Emacs was installed with Macports) looks like this :

 ls /opt/local/share/emacs/24.4/etc/themes/
 adwaita-theme.el            light-blue-theme.el         tsdh-dark-theme.el
 deeper-blue-theme.el        manoj-dark-theme.el         tsdh-light-theme.el
 dichromacy-theme.el         misterioso-theme.el         wheatgrass-theme.el
 emacs-color-theme-solarized tango-dark-theme.el         whiteboard-theme.el
 leuven-theme.el             tango-theme.el              wombat-theme.el

where emacs-color-theme-solarized is the directory. Then I added (load-theme 'solarized-dark t) to my .emacs file and when I re-initiate emacs I get the error: Unable to find theme file for 'solarized-dark .

I have tried to move all file within the emacs-color-theme-solarized directory directly into the /opt/local/share/emacs/24.4/etc/themes/ directory, so that:

ls /opt/local/share/emacs/24.4/etc/themes/
LICENSE                      leuven-theme.el              tango-dark-theme.el
README.md                    light-blue-theme.el          tango-theme.el
adwaita-theme.el             makepkg.sh                   tsdh-dark-theme.el
color-theme-solarized-pkg.el manoj-dark-theme.el          tsdh-light-theme.el
color-theme-solarized.el     misterioso-theme.el          wheatgrass-theme.el
deeper-blue-theme.el         solarized-dark-theme.el      whiteboard-theme.el
dichromacy-theme.el          solarized-definitions.el     wombat-theme.el
emacs-color-theme-solarized  solarized-light-theme.el 

follow the same process and obtained the same result. Finally, I read here: Emacs 24 Package System Initialization Problems that a possible solution is adding the following two lines at the beginning of my .emacs file:

(setq package-enable-at-startup nil)
(package-initialize)

So I did and obtained the same result. Even loading the theme manually: load-theme and then solarized-dark is not solving the issue. It seems like any changes done to that directory are ignored by .emacs.

By the way, I also tried to add (add-to-list 'load-path " /opt/local/share/emacs/24.4/etc/themes") to my .emacs file as well as (add-to-list 'load-path " ~/emacs.d/themes"), and it was, also, unsuccessful.

In case is of any use, any of the themes that come with the instalation, e.g (load-theme 'tsdh-dark t), work perfectly

Any ideas of how to solve this issue for the solarized theme?

thanks and happy new year!

Community
  • 1
  • 1
Javier
  • 1,530
  • 4
  • 21
  • 48

1 Answers1

12

Emacs 24 includes package.el, and I strongly recommend using that to install packages whenever possible. Versions of the Solarized theme are available from MELPA Stable, MELPA, and Marmalade.

If you haven't used any of these package repositories yet, you'll need to add one by putting something like this in your init file:

(require 'package)
(package-initialize)

(add-to-list 'package-archives
             '("melpa-stable" . "http://stable.melpa.org/packages/") t)

Then use M-x package-list-packages, search for color-theme-sanityinc-solarized, mark it for installation with i and then install marked packages with x. I find this package list interface very handy for discovering new packages.

Packages installed this way generally go into ~/.emacs.d/elpa/, e.g. ~/.emacs.d/elpa/color-theme-solarized-2.27/. This should automatically be added to your custom-theme-load-path, which is required for load-theme to work.

Note that this particular version includes two themes prefixed with the package maintainer's name, so you'll have to do something like

(load-theme 'sanityinc-solarized-dark)  ; or
(load-theme 'sanityinc-solarized-light)

to make the theme load. Interactively, load-theme supports tab completion, which is probably the best way to see what installed themes are actually called.

As an aside, you might also want to look into tools for automating the package.el install process, which is especially handy if you work on multiple machines.

Community
  • 1
  • 1
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • I have done so, and the package is installed, thanks Chris. However, when I type `(load-theme 'solarized-dark t)` I still get the exact same error. Also, where is the package installed? how can I point to it? – Javier Dec 31 '14 at 13:33
  • 1
    I have been able to do it through `M-x color-theme-sanityinc-solarized-dark`. But ideally I would prefer to do it from the `.emacs` file. – Javier Dec 31 '14 at 13:48
  • In any case Chris, I just managed to do it manually (the `load-theme` command did not work). Using `M-x color-theme-sanityinc-solarized-dark` and then editing a little bit the `.emacs` file (given the fact that I had a series of `custom-set-faces` that I had to adapt). Thanks for the help. Problem solved! – Javier Dec 31 '14 at 14:27
  • 1
    @Javier, I have updated my answer to specify where ELPA packages are stored and clarify that this package's themes aren't actually called `solarized-dark` and `solarized-light`, which is probably why your call to `load-theme` failed. – ChrisGPT was on strike Dec 31 '14 at 14:37
  • Many thanks Chris, it does work (silly me!). Perfect. All set up for proper coding ;) – Javier Dec 31 '14 at 14:40