I've pulled the starter-kit from https://github.com/technomancy/emacs-starter-kit, and it was installed in ~/.emacs.d/elpa
. Following the instruction of the starter-kit.el
, I put my user-specific customization in ~/.emacs.d/$USER.el
:
(require 'color-theme-solarized)
(color-theme-solarized-dark)
(require 'auto-complete)
(global-auto-complete-mode)
But when I started emacs, it says
File error: Cannot open load file, color-theme-solarized
I checked the load-path
variable and found that the path of color-theme-solarized
wasn't in it. So I add this before "require" it:
(add-to-list 'load-path "~/.emacs.d/elpa/color-theme-solarized-20120301)
However the error still occurs.Then I referred to elpa's wiki and it says that all the packages are initialized after the init.el
is loaded. Then I read the starter-kit.el
and found that the $USER.el
is added to after-init-hook
, which means that the error shouldn't occur since the $USER.el
is loaded at the end of initializing. I desperately move all my customization to the end of init.el
, to my surprise, it just work fine. It seems that the init.el
is loaded at last rather than at first.
How could I make my customization work except writing it in the init.el
? I don't want to make the init.el
too long.
ps: I've put (require 'package)
and (package-initialize)
at the beginning of init.el
and it doesn't make a difference.
ELPA adds autoloads for your packages. I don't use themes, but typically you would do something like (eval-after-load "color-theme" (quote (color-theme-solarized)))
, or, if you want it to run after it has just autoloaded (but not fully loaded), (eval-after-load "color-theme-autoloads" (quote (color-theme-solarized)))
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With