Skip to content

Instantly share code, notes, and snippets.

@pkkm
Created August 29, 2013 15:26
Show Gist options
  • Select an option

  • Save pkkm/6379532 to your computer and use it in GitHub Desktop.

Select an option

Save pkkm/6379532 to your computer and use it in GitHub Desktop.

Revisions

  1. pkkm created this gist Aug 29, 2013.
    18 changes: 18 additions & 0 deletions package.el
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    (package-initialize) ; Load package.el and all packages now. This normally happens after loading the init file.
    (setq package-enable-at-startup nil) ; Don't load the packages the second time after the init file.

    (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
    ("melpa" . "http://melpa.milkbox.net/packages/")))

    ;; To update installed packages, use M-x package-list-packages RET U x.
    ;; Or delete the elpa/ directory and launch Emacs for it to be recreated.

    (defun package-ensure-installed (package)
    "Ensure the ELPA package PACKAGE is installed."
    (unless (package-installed-p package)
    (unless package-list-refreshed-p
    (package-refresh-contents)
    (setq package-list-refreshed-p t))
    (package-install package)))
    (defvar package-list-refreshed-p nil
    "Was the package list refreshed in this Emacs session?")