technomancy / emacs-starter-kit

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

esk-user-dir files should be loaded after ELPA has completed #107

Closed mamciek closed 12 years ago

mamciek commented 12 years ago

Starter kit has a nice feature of autoloading all files from directory called the same as username. Starting from version 24 however there is a problem with it. Those files are loaded just after starter kit is loaded by package.el mechanism. The problem is that those files are evaluated before rest of ELPA (or Marmalade) packages are loaded, so i cannot use any functions from packages that are loaded after the starterkit. It should be fixed so files in user-dir are evaluated AFTER package.el has loaded all packages

technomancy commented 12 years ago

Unfortunately the starter kit is a package now, so it gets loaded with all the other packages. If you have any ideas of how this would be implemented I'm open to the idea, but I don't think it's possible with the way packages work.

In most cases it's best to just move everything that needs packages to init.el, which doesn't have this restriction.

mamciek commented 12 years ago

unfortunately i do not know Lisp enough to propose implementation but I can see two possible solutions:

  1. (simple) Code that loads those files can be moved into some function fun_x, so that i can just call it in init.el after packages have been evaluated - it won't be called during starter-kit package evaluation
  2. (elegant) Is there some hook defined by package.el that is called at the end of the process? Well - it should be :) If there is one then you could attach your code there and load user-specific files

Actually I can prepare pull request with solution 1 if you think it is acceptable

DarwinAwardWinner commented 12 years ago

Some options:

Delayed execution (fix it yourself)

You can put this:

(eval-after-load 'foo
  '(progn
     (turn-on-foo-mode)
     (do-more-foo-stuff)))

Or this:

(add-hook 'after-init-hook (lambda ()
  (require 'foo)
  (turn-on-foo-mode)
  (do-more-foo-stuff)))

into your starter kit init files.

Fix in Starter Kit

See https://github.com/technomancy/emacs-starter-kit/issues/108