2

It's time. I've spent too long with too many pieces of elisp lying around in site-lisp, outdated until I manually grab a new copy. I am new to the ELPA/MELPA/package.el/el-get world, but have determined (okay, maybe 90% confident) from emacswiki and this excellent question that MELPA is the way to go, but how, exactly do I do that? There are some basic instructions for initial setup on the website, but it's not clear to me how I should migrate, and tell emacs:

  • Which pieces to check on
  • Where and how to store them
  • What to do with my local copies
  • 1
    Just a general clarification. GNU Elpa and Melpa are not mutually exclusive, in fact, Melpa relies on you using GNU Elpa too. Also, package.el is not an alternative to the others, it is the library that allows you to interact with Melpa, GNU Elpa, Marmalade, and other such repos. – Malabarba Sep 3 '15 at 8:43
7

Basic packages

The basic way to use packages^(1) is pretty simple:

Add to your init file:

(require 'package) ;; You might already have this line
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
  (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line

Then, run M-x list-packages to get the package menu. From this menu, you can search for packages, view descriptions, install, uninstall, and update packages. Press i to mark a package for installation, d for marking a package for uninstallation (deletion), or U to mark all installed packages that can be upgraded for upgrading. Then, pressing x will perform these actions.

Freedom from management

Using package installation will handle storing things for you; you don't have to worry about managing files or directories. Once you replace a locally-installed .el file with a package from a repository, you can get rid of the local file and the load instructions from your init file. You will need to keep any configuration of that package, however.

Advanced packages

Other methods include things like Cask, which is a way of automating the management of installed packages. You have a file of packages you want installed, and you can have Cask do installations and upgrades automatically.

[1] Note that this way of dealing with packages is not specific to MELPA -- it will work with the GNU ELPA repo, or Marmalade -- you just have to find the proper location to add to 'package-archives.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.