Install Emacs packages with ELPA

ELPA makes the installation of Emacs packages very easy! The description below is for Emacs 23, and I use Ctrl+ and Alt+ rather than the classic C- and M-.

Install ELPA

In a buffer, paste the following:

 (let ((buffer (url-retrieve-synchronously
	       "http://tromey.com/elpa/package-install.el")))
  (save-excursion
    (set-buffer buffer)
    (goto-char (point-min))
    (re-search-forward "^$" nil 'move)
    (eval-region (point) (point-max))
    (kill-buffer (current-buffer))))

and evaluate with Ctrl+J. This automatically downloads ELPA and installs it.

Run ELPA

Type Alt+X package-list-packages, this opens a buffer with a list of packages that can be installed. Here are the commands:

  • n: go to next line,
  • i: select package for installation,
  • u: de-select package,
  • r: refresh package list,
  • x: actually install all the marked packages,
  • h: help,
  • q: close ELPA.

Example

To install ruby-mode, do Ctrl+S ruby-mode and press Enter. Select package for installation with i , and do the installation with x.

 
---

Comment

  1. I tried your code, above, and got the message:

    Autoloading failed to define function url-retrieve-synchronously

    Steve Kelem · 2012-07-25 23:41 · #

  2. You need to load the `url` package to get `url-retrieve-synchronously`: http://emacswiki.org/emacs/UrlPackage

    sebastien · 2012-10-04 09:18 · #

your_ip_is_blacklisted_by sbl.spamhaus.org

---