Skip to content

Instantly share code, notes, and snippets.

@kozross
Created January 15, 2015 22:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kozross/e49a5acf0f3fb9fd0dd5 to your computer and use it in GitHub Desktop.
Save kozross/e49a5acf0f3fb9fd0dd5 to your computer and use it in GitHub Desktop.
;;method to check if all packages are installed
(defun packages-installed-p ()
(loop for p in required-packages
when (not (package-installed-p p)) do (return nil)
finally (return t)))
;;if not all packages are installed, check one by one and install the missing ones
(unless (packages-installed-p)
;;check for new packages
(message "%s" "Emacs is now refreshing its package database...")
(package-refresh-contents)
(message "%s" "done!")
;;install the missing packages
(dolist (p required-packages)
(when (not (package-installed-p p))
(package-install p))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment