use-package auto-install magic
This little snippet was very handy creating an easy auto-installer for use-package. Makes moving init.el between systems easier...
;; Make sure the packages install if not there
(defun init/auto-install (pkg &rest args)
"My installer function, pass PKG and ARGS."
(unless (package-installed-p pkg)
(message "++++ Installing package %s ++++" pkg)
(package-install pkg)))
;; Make sure use-package is installed, advise and load use-package
(init/auto-install 'use-package)
(advice-add 'use-package :before #'init/auto-install)
(require 'use-package)
Posted Jul 16, 2017, 9:56 PM UTC
33