To add the repository put this before the call to package-initialize
in your init.el
file.
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
In Emacs < 24, you'll also need to explicitly include the GNU
ELPA archive, which provides important compatibility libraries like cl-lib
:
(when (< emacs-major-version 24)
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
What if you only want some of your packages to be installed from MELPA, and the rest from Marmalade or elsewhere?
Only in the very latest Emacs snapshots is there a way to
exclude or include versions according to their source
(see package-pinned-packages
). For all other
users, we provide a package-filter.el
package (available
in MELPA) that will allow you to enable only certain packages
or exclude certain packages.
You can install the package
manually by pasting this into your *scratch*
buffer and evaluating it.
(progn
(switch-to-buffer
(url-retrieve-synchronously
"https://raw.github.com/milkypostman/package-filter/master/package-filter.el"))
(package-install-from-buffer (package-buffer-info) 'single))
You can then customize two variables:
package-archive-enable-alist
Optional Alist of enabled packages used
by package-filter
. The format
is (ARCHIVE . PACKAGE ...)
,
where ARCHIVE
is a string matching an archive
name inpackage-archives
, PACKAGE
is a symbol of a package in ARCHIVE
to
enable.
If no ARCHIVE
exists in the alist, all
packages are enabled.
package-archive-exclude-alist
Alist of packages excluded by package-filter
. The format is (ARCHIVE . PACKAGE
...)
, where ARCHIVE
is a string
matching an archive name
inpackage-archives, PACKAGE
is
a symbol of a package in that archive to exclude.
Any specified package is excluded regardless of the value
of package-archive-enable-alist
Note: These fixes are included in
the package-filter.el
package.
There is a small bug in Emacs24’s package.el
such
that the dependency order comes out backwards. The problem is
patched by some advice.
(defadvice package-compute-transaction
(before package-compute-transaction-reverse (package-list requirements) activate compile)
"reverse the requirements"
(setq requirements (reverse requirements))
(print requirements))
package.el
now includes a mechanism to upgrade
packages. After running package-list-packages
,
type U (mark Upgradable packages) and then x
(eXecute the installs and deletions). When it’s done
installing all the packages it will ask if you want to delete
the obsolete packages and so you can hit y (Yes).
If you run into a problem installing or upgrading, you may
need to go into your ~/.emacs.d/elpa/
directory
and delete packages that are installed multiple times. This
can happen when the install times out.
https://github.com/milkypostman/melpa
Contributions are welcome. Currently, the builder supports packages using git, subversion, mercurial, bzr, cvs, darcs, fossil and emacswiki.