ELPA

I've been meaning to install ELPA for a long time but never got around to it. Then Emacs 24 was on the horizon and I thought, “Why bother going through the pain of installing it when it will be included in Emacs 24 anyway?” Now, Xah Lee has shamed me into it by posting his Guide on the Emacs Package System.

It is astounding how easy the installation is. Simply cut a bit of Elisp from Lee's page, paste it into an Emacs buffer, evaluate the buffer and you're done. The Elisp that you paste retrieves the ELPA installer and executes it. The installer makes an elpa directory in ~/.emacs.d/, populates it with the necessary files including package.el, and adds some Elisp to your .emacs or init.el file to load the packages you install when Emacs starts.

Lee includes a section on what to do when you upgrade to Emacs 24. It mostly involves removing the ELPA code from your .emacs, deleting the ~/.emacs.d/elpa subdirectory, and reinstalling the packages you had loaded.

I did run into one problem. By default, ELPA uses the tromey.com/elpa package server but I wanted to use the more extensive Marmalade server. Lee has instructions on how to do that. You just add

(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))

to your .emacs or init.el file and execute it. Unfortunately, the package-archives variable doesn't exist in the package.el that got downloaded. The Marmalade site (Lee has a link to it) points to a slightly never version that does have it so I just installed that instead. No problems so far and I saved the old version in case there are any.

One of the nice things about ELPA is that it stores everything in your ~/.emacs.d/elpa subdirectory so it's easy to keep my machines in sync since ~/.emacs.d is under Git. All in all, a big win for me.

This entry was posted in General and tagged . Bookmark the permalink.

12 Responses to ELPA

  1. Xah Lee says:

    hi Jon, thanks for the link, and for the tip on getting Marmalade to work.

  2. jerry says:

    Yeah, ELPA is pretty nice.

    I wish the instructions for how to make an elpa package and host it were a bit cleaner.

  3. Ozan Sener says:

    I also have melpa in my package-archives. It provides more up-to-date packages built straight from VCS.

  4. Alex Ott says:

    There is also el-get that is very useful if you want to be in sync with latest development versions of packages... It allows to get packages from different VCS (git, hg, etc.), download from http servers, ELPA, emacswiki, etc.

  5. Jaskirat says:

    Hmm, I have .gitignore set to ignore the elpa folder. Contemplating if its worth removing after reading your bit of using git to persist installed packages using git. FWIW, emacs-starter-kit defaults to ignoring the elpa folder.

    • jcs jcs says:

      Ignoring it probably makes sense in most cases. In my case I'll be using it to keep machines synced so it seems like a good idea. The alternative is download the packages on each machine. With ELPA that's not as big a deal is it was before when I had to go to the package site, load it into my tools directory, and then set up pointers in init.el.

  6. Tetro says:

    Is there a way to change the path where ELPA stores the packages to an other subdirectory than ~/.emacs.d/elpa ?
    I'd like to put it in my dropox.

    Thanks !

    • jcs jcs says:

      Take a look at the package-user-dir and package-directory-list customization variables. It looks as if these control where the packages get stored.

  7. jpkotta says:

    I don't see how putting elpa/ in revision control or dropbox is worthwhile. Here's my config: http://pastebin.com/dqY7VwFm. It installs any missing packages on start up.

    • jcs jcs says:

      The version control happens automatically for me because I have .emacs.d in Git. The benefit for me is that it keeps multiple machines in sync but I can see how your method allows you to just sync .emacs and have the other machines do their own synchronization. A nice solution, actually.

  8. I am using Emacs 24 on Ubuntu 11.10 (using emacs-snapshot-nox from http://emacs.naquadah.org/). The following line:
    (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
    is not working for me.

    I was able enable Marmalade using 'Customize'. Or you can add the following code fragment to your emacs init file:

    (custom-set-variables
    '(package-archives
    (quote (
    ("marmalade" . "http://marmalade-repo.org/packages/")
    ("gnu" . "http://elpa.gnu.org/packages/")
    )
    )
    )
    )

Comments are closed.