Install packages

Many of the tips I cover here will work with standard emacs, but sometimes we will need to have extra packages installed for additional functionality.

Installing packages in emacs is a bit like adding extensions to your browser – they add lots of extra functionality that can be very useful.

The easiest way to install packages is to use the command package-list-packages and them search for the package you want (using e.g. C-s) and then mark it for installation by pressing i and then install all marked packages by pressing x.

Packages are available from various sources, and to get the best selection you should add the following to your emacs config file to add the MELPA package repository, and then restart emacs:

;;Add MELPA repository
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/") t)

You might also consider adding MELPA-stable and marmalade, but MELPA should be fine for most things.

We will need to install packages for some of the future tips I will cover, but in the mean time, have a look through the list of available packages and be impressed with the huge potential!

update – use-package

I have moved to using the use-package package to simplify the installation and configuration of packages. There is a great article on this at mastering emacs.

  • Please update this post to avoid suggesting to users that they rely on an HTTP URL. The correct one they should be using is:

    https://melpa.org/packages/

    • Ben Maughan

      Done – thanks for the comment.

  • hackonteur

    That didn’t work for me in Emacs 24.5 until I added:

    (require 'package)