Skip to content

Instantly share code, notes, and snippets.

@slackorama
Created October 6, 2011 22:37
Show Gist options
  • Save slackorama/1268904 to your computer and use it in GitHub Desktop.
Save slackorama/1268904 to your computer and use it in GitHub Desktop.
autload elpa packages. Taken from emacs-starter-kit.
;;; elpa-autoload.el -- install a base set of package automatically
;;; lifted from emacs-starter-kit
;;; http://github.com/technomancy/emacs-starter-kit/raw/master/starter-kit-elpa.el
(defvar ssm-kit-packages (list 'anything
'anything-config
'full-ack
'gist
'htmlize
'json
'magit
'org
'org-odt
'paredit
'color-theme-zenburn
'smex)
"Libraries that should be installed by default.")
(defun ssm-elpa-install ()
"Install all starter-kit packages that aren't installed."
(interactive)
(dolist (package ssm-kit-packages)
(unless (or (member package package-activated-list)
(functionp package))
(message "Installing %s" (symbol-name package))
(package-install package))))
(defun esk-online? ()
"See if we're online.
Windows does not have the network-interface-list function, so we
just have to assume it's online."
;; TODO how could this work on Windows?
(if (and (functionp 'network-interface-list)
(network-interface-list))
(some (lambda (iface) (unless (equal "lo" (car iface))
(member 'up (first (last (network-interface-info
(car iface)))))))
(network-interface-list))
t))
;; On your first run, this should pull in all the base packages.
(when (esk-online?)
(unless package-archive-contents (package-refresh-contents))
(ssm-elpa-install))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment