Emacs package management

From wikinotes

Emacs ships with a package/plugin manager.

Usage

Provided that you have the package-archives variable (defined below) set up, you can search/download from the package-archives using:

<M-x>   package-list                  ;; show all packages
<M-x>   package-refresh-contents      ;; refresh package index
<C-s>  <package-you-are-looking-for>  ;; install package

Configuration

Init/Auto Install Packages

;; Package Initialization
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
                         ("org" . "https://orgmode.elpa/")
                         ("elpa" . "https://elpa.gnu.org/packages/")))
(require 'package)
(package-initialize)
(unless package-archive-contents (package-refresh-contents))
(unless (package-installed-p 'use-package) (package-install 'use-package))
(require 'use-package)
(setq use-package-always-ensure t)

Adding Packages

Now that you have the base install, all you need to auto-install a package is:

(use-package neotree :ensure t)

If you're having issues downloading a package, try

<M-x> package-refresh-contents