technomancy / emacs-starter-kit

[ARCHIVED] this is ancient history
GNU General Public License v3.0
2.86k stars 887 forks source link

packages from elpa appears in load-path after user-specific configuration #109

Closed eoranged closed 12 years ago

eoranged commented 12 years ago

The problem is when I'm adding something like

(require 'color-theme)

to my ~/.emacs.d/eoranged.el (assuming eoranged is my username), I see error message during startup like this:

Warning (initialization): An error occurred while loading `/home/eoranged/.emacs.d/init.el':   
File error: Cannot open load file, color-theme

The problem is not only with color-theme, but with any package, which is not loaded by starter-kit itself. I'm not elisp guru, but looks like that packages from ~/.emacs.d/elpa are appears in load-path only after eoranged.el (and el/org files in ~/.emacs.d/eoranged/ directory).
For now I've moved lots of mode-specific requirements to module-hooks and it works for me, but things like color-scheme, autopair and others are global (I want them to be) and I do not want to create hooks for each mode to load it.
I like starter-kit's way, but this thing looks strange for me.

Some information, which may be useful:

Thanks in advance, Vladimir.

sluukkonen commented 12 years ago

The issue seems to stem from the fact that there is no real way of controlling package load order within ELPA (outside explicit dependencies, at least), so it's not guaranteed that Emacs Starter Kit will be loaded last. In some cases, using eval-after-load blocks is enough to work around the problem, but in others, it's not.

I solved this by basically copying the user-specific configuration code from starter-kit.el and placing them in the end of my init.el, while changing the file naming structure a bit, to ensure that the the code in starter-kit.el never actually loads anything. For example,

(setq my-config-dir (concat user-emacs-directory "config"))
(add-to-list 'load-path my-config-dir)
(when (file-exists-p my-config-dir)
  (mapc 'load (directory-files my-config-dir nil "^[^#].*el$")))
DarwinAwardWinner commented 12 years ago

Hopefully my pull request should solve this: https://github.com/technomancy/emacs-starter-kit/pull/108

I'm not actually a user of ESK, though, so I can't easily test it. If someone can post a minimal init file (or init directory) that reproduces the problem, I can test whether #108 fixes it. Alternatively, you can apply #108 to your copy of ESK and see if it fixes things for you.

eoranged commented 12 years ago

@DarwinAwardWinner It's .emacs.d which can help reproduce the problem: http://ompldr.org/vYmZzeQ/emacs.d.tar.gz Your patch didn't helped (applied in archive I mentioned above), the problem still reproducible.

DarwinAwardWinner commented 12 years ago

I'm getting a 503 error when I try to download that file.

eoranged commented 12 years ago

@DarwinAwardWinner There is no need to: after autoloads regeneration it worked for me. Thanks for help. I'm closing the issue (#109 fixes the problem).