Emacs/The Emacs Lisp Package Archive

From Wikibooks, open books for an open world
Jump to navigation Jump to search

The Emacs Lisp Package Archive, ELPA, makes it easy to download and install packages for emacs. The official site of ELPA is at http://tromey.com/elpa/.

Getting started with ELPA[edit | edit source]

Installing the package manager[edit | edit source]

In Emacs 22 and above, the necessary modules are already present to install the package manager from a small bootstrap script. Simply copy and paste the following code in to a *scratch* buffer and execute it with C-j if you're in lisp interaction mode, C-x C-e otherwise.

(let ((buffer (url-retrieve-synchronously
    (set-buffer buffer)
    (goto-char (point-min))
    (re-search-forward "^$" nil 'move)
    (eval-region (point) (point-max))
    (kill-buffer (current-buffer))))

The package manager should install itself.

If you are using Emacs 21, you will need to have the wget utility available. Execute the following code:

(let ((buffer (get-buffer-create (generate-new-buffer-name " *Download*"))))
      (set-buffer buffer)
      (shell-command "wget -q -O- http://tromey.com/elpa/package-install.el"
      (eval-region (point-min) (point-max))
      (kill-buffer (current-buffer))))