sellout / emacs-color-theme-solarized

Emacs highlighting using Ethan Schoonover’s Solarized color scheme
http://ethanschoonover.com/solarized
MIT License
1.16k stars 202 forks source link

Cannot open load file: solarized-definitions #174

Open 4r1y4n opened 9 years ago

4r1y4n commented 9 years ago

I'm using emacs 24.3.1 and i'm trying to load solarized theme:

GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7) of 2014-03-07 on lamiak, modified by Debian  

I copied

into my ~/.emacs.d
then I run M-x load-theme -> solarized or M-x customize-themes -> check solarized in both ways I get "cannot open load file: solarized-definitions" !

What is the problem?

sellout commented 9 years ago

Not to be curt, but just to ensure I make the directions as clear as possible for everyone, can you start from https://github.com/sellout/emacs-color-theme-solarized/blob/master/README.md#installation--usage and let me know if you have any issues then? Thanks.

4r1y4n commented 9 years ago

Actually I did ! I just summarized it here!
doing what https://github.com/sellout/emacs-color-theme-solarized/blob/master/README.md#installation--usage says (at Emacs 24 section) causes same error on startup:

Warning (initialization): An error occurred while loading `/home/r1y4n/.emacs':

File error: Cannot open load file, solarized-definitions

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace.

While the solarized-definitions.el is there:

r1y4n@r1y4n-PC:~/.emacs.d$ ls -l
total 156
drwx------   3 r1y4n r1y4n  4096 Nov 29 18:29 ./
drwx------ 124 r1y4n r1y4n 69632 Nov 29 18:18 ../
drwx------   2 r1y4n r1y4n  4096 Nov 29 18:21 auto-save-list/
-rw-rw-r--   1 r1y4n r1y4n  1757 Jun 25 18:03 color-theme-solarized.el
-rw-rw-r--   1 r1y4n r1y4n 41331 Jun 25 18:03 solarized-definitions.el
-rw-rw-r--   1 r1y4n r1y4n   250 Nov 29 18:09 solarized-theme.el

Note: copying the directory doesnt load the theme (in emacs24 custom-theme-load-path is the ~/.emacs.d and not any subdirectory is scanned)

4r1y4n commented 9 years ago

Now It I know the problem is in solarized-theme.el file.
If I change these:

(require 'solarized-definitions
         (locate-file "solarized-definitions.el" custom-theme-load-path
                      '("c" "")))

to these:

(require 'solarized-definitions
         (locate-file "/home/r1y4n/.emacs.d/solarized-definitions.el"
                      '("c" "")))

The theme loads properly. So the problem is in the path variable!

sellout commented 9 years ago

What is the value of custom-theme-load-path?

sellout commented 9 years ago

Also, if you have the source files in .emacs.d/, you haven't followed the README directions. In general, I would recommend against putting multiple files from a single package directly in .emacs.d/ and would also recommend against adding .emacs.d/ to custom-theme-load-path.

4r1y4n commented 9 years ago

it is:

 (custom-theme-directory t)

and the value of custom-theme-directory itself is

"~/.emacs.d/"

I'm on default installation of emacs24 on ubuntu 14.04

4r1y4n commented 9 years ago

I didn't add anything to custom-theme-load-path it is its default value!
if I put the emacs-color-theme-solarized folder in .emacs.d/ (and not directly source files in there) it doesn't load the theme at all ! and gives:

error: Unable to find theme file for `solarized'
sellout commented 9 years ago

Right, the README directs you to add something to custom-theme-load-path. Once you put the directory in .emacs.d, you should add ~/.emacs.d/emacs-color-theme-solarized/ to custom-theme-load-path.

I believe custom-theme-load-path is broken as defined, because functions that take path lists (like locate-file) don't interpret symbols (like custom-theme-directory) as variables (although I wouldn't be against adding support for that) and certainly shouldn't interpret t as etc/themes/.

And anything that attempted to put part of the theme in custom-theme-load-path And another part in load-path would be more complicated than just pointing custom-theme-load-path at Solarized.

I'll submit an issue against emacs about the custom-theme-load-path behavior, but in general, I don't think it's a big deal, because it's much better to not put the sources from multi-file packages directly in .emacs.d.

4r1y4n commented 9 years ago

Right, by adding a

(add-to-list 'custom-theme-load-path "~/.emacs.d/emacs-color-theme-solarized")

to .emacs file solves it; but believe me README doesn't mention it ;-) (I expected that emacs should scan dirs automatically) Thank you very much

sellout commented 9 years ago

The first step in the instructions is “Add the emacs-color-theme-solarized directory to your Emacs custom-theme-load-path.”

I'm happy to rephrase it to be clearer, if you have any suggestions.

4r1y4n commented 9 years ago

;-) I understood it as "Copy emacs-color-theme-solarized directory to where custom-theme-load-path variable points to".
Maybe this can be a more clear sentence:
Copy emacs-color-theme-solarized directory to your desired location (e.g. ~/.emacs.d ) and add its path to custom-theme-load-path variable.

Thank you anyway and excuse me for wasting your time ;-)

prayagupa commented 8 years ago

I am having similar issue on MacOS, I don't have custom-theme-load-path defined. And emacs version is 24+.

$ emacs --version
GNU Emacs 24.5.1
Copyright (C) 2015 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

funny thing is (Load-theme 'solarized t) works. but not (Load-theme 'solarized-dark t)

screen shot 2016-03-27 at 11 23 04 pm

here's my init.el - https://github.com/prayagupd/dotfiles-mac/blob/master/.emacs.d/init.el

sellout commented 8 years ago

@prayagupd There are no longer solarized-dark and solarized-light themes, there’s only solarized, and dark/light is set via the frame’s background-mode (so you can have some dark frames and some light), as described at https://github.com/sellout/emacs-color-theme-solarized#all-versions

prayagupa commented 8 years ago

@sellout I'm stupid. I was using this theme with ubuntu for years. I just copied to macos and I was wondering why it doesn't work. Went through README too, but I'm really stupid that I couldn't notice the change.

I saw (set-frame-parameter nil 'background-mode 'dark). Will check. Thanks

sellout commented 8 years ago

No worries. It’s not like I version or have a changelog or anything. I gotta fix that.