how to install just one package from MELPA and not others

1. background

There are two well known Emacs package archives: GNU ELPA and MELPA (well, there’s also Marmalade). The user option package-archives by default includes GNU ELPA but not MELPA. MELPA packages are usually coming right from Github, and they aren’t stable releases. Say you don’t want MELPA in your package-archives list because you don’t want to get unstable updates from MELPA. What to do then if you want just one or two packages from MELPA?

2. installing or updating one package from MELPA

Let’s take SLIME as an example, which is a package for making working with general Lisp code as comfortable as working with Emacs Lisp code. (Actually, you might want to use quicklisp instead for installing SLIME, but that’s another story.)

SLIME is available on the Marmalade archive but as of now, the version on that archive is 20100404.1 which is very old and may be buggy. Let’s install SLIME from the MELPA archive instead. Yes the MELPA one can be buggy too, but if you submit a bug report and if the bug gets fixed, the fix will come to the MELPA one first.

This is how I installed SLIME:

  • If you already have SLIME, uninstall it first.
  • Check if it’s uninstalled successfully by restarting Emacs and then doing M-x locate-library RET slime RET
  • Begin a clean session of Emacs by running:
    emacs -q
    

    and then in that session, evaluate the following code:

    (require 'package)
    (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
    (package-initialize)
    (list-packages)
    

    which will show the package list. You can find SLIME from the giant list by passing ^ slime (one caret and two spaces followed by the word slime) to M-x occur. Install SLIME from there.

If you want to update SLIME later, you repeat that again.

3. checking if the package is installed correctly

  • Restart Emacs
  • Do M-x locate-library RET slime RET to see the full path of slime.elc and see if there is anything wrong (such as the version number in the directory name being too old)
This entry was posted in Emacs and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s