In my ELPA With Emacs 24 post, I documented some of the problems I was having getting ELPA to work with Emacs 24 and showed some Elisp to work around the problem. Fortunately, my readers are a lot smarter than I am and suggested better ways of getting things to work.
The answer turns out to be pretty simple. I replaced all my special code for setting paths and requiring package with:
(package-initialize) (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
and left everything else the same. So far that seems to be working perfectly. The documentation isn’t really clear on this and, in fact, hints that putting
(package-initialize)
in your .emacs
or init.el
file can cause problems with other packages. I haven’t seen that and neither have any of my commenters so unless I run into problems later, my recommendation is to simply add the package-initialize
near the top of your .emacs
or init.el
.
None of this means, of course, that you won’t have to configure some of the packages you load with ELPA but at least Emacs won’t throw an error during startup because of missing packages. Thanks to Seth, Philipp, and Foo for their helpful comments.