I’m keeping this configuration synchronized between two machines. For most changes simply pushing the change to my Emacs Reboot GitHub repo and pulling it on the other machine is all I need. But when the customizations depend on a certain package being installed, the configuration breaks on the other machine until I manually install the package.

Today I add a customization which ensures all needed packages are installed at the time Emacs starts up:

Lisp

1

2

3

4

5

6

7

8

9

10

11

(setqpackage-archives

'(("gnu"."http://elpa.gnu.org/packages/")

("marmalade"."http://marmalade-repo.org/packages/")

("Tromey"."http://tromey.com/elpa/")))

(package-initialize)

(setqabg-required-packages

(list'xml-rpc'magit'gh))

(dolist(packageabg-required-packages)

(when(not(package-installed-ppackage))

(package-refresh-contents)

(package-installpackage)))

This code is pretty straightforward: first, define the list of package archives to search, and make sure the package system is initialized. Then define a list of needed packages, and iterate over the list, installing the ones which are missing from this Emacs.