Skip to content

Instantly share code, notes, and snippets.

@blarghmatey
Last active August 29, 2015 14:00
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 blarghmatey/11221828 to your computer and use it in GitHub Desktop.
Save blarghmatey/11221828 to your computer and use it in GitHub Desktop.
Emacs Package Synchronization
(defun installed-packages ()
"Return the list of installed packages."
(mapcar 'car package-alist))
(defun save-package-list ()
"Save the list of installed packages to a file."
(interactive)
(with-temp-file "~/Dropbox/.emacs-packages-installed.el"
(insert (format "(defvar my-packages '%s)" 'installed-packages))))
(add-hook 'kill-emacs-hook 'save-package-list)
(load-file "~/Dropbox/.emacs-packages-installed.el")
(dolist (p my-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