Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot open load file: solarized-definitions #174

Open
4r1y4n opened this issue Nov 29, 2015 · 15 comments
Open

Cannot open load file: solarized-definitions #174

4r1y4n opened this issue Nov 29, 2015 · 15 comments

Comments

@4r1y4n
Copy link

4r1y4n commented Nov 29, 2015

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

  • solarized-theme.el
  • color-theme-solarized.el
  • solarized-definitions.el

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
Copy link
Owner

sellout commented Nov 29, 2015

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
Copy link
Author

4r1y4n commented Nov 29, 2015

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
Copy link
Author

4r1y4n commented Nov 29, 2015

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
Copy link
Owner

sellout commented Nov 29, 2015

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

@sellout
Copy link
Owner

sellout commented Nov 29, 2015

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
Copy link
Author

4r1y4n commented Nov 29, 2015

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
Copy link
Author

4r1y4n commented Nov 29, 2015

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
Copy link
Owner

sellout commented Nov 29, 2015

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
Copy link
Author

4r1y4n commented Nov 29, 2015

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
Copy link
Owner

sellout commented Nov 29, 2015

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
Copy link
Author

4r1y4n commented Nov 29, 2015

;-)
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
Copy link

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
Copy link
Owner

sellout commented Mar 28, 2016

@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
Copy link

@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
Copy link
Owner

sellout commented Mar 28, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants