-(package-initialize)
+(require 'package)
 
 ;; Package source configuration.
 (add-to-list 'package-archives
              '("melpa" . "https://melpa.org/packages/"))
+
+(package-initialize)
+
+(when (not package-archive-contents)
+  (package-refresh-contents))
 
 ;; Package configuration.
 


;; Enable useful minor modes
(global-linum-mode 1)
(ido-mode 1)
(show-paren-mode 1)
(global-company-mode 1)


  :ensure t
  :pin melpa)

;; https://github.com/purcell/exec-path-from-shell
(use-package exec-path-from-shell
  :ensure t
  :pin melpa)

;; https://github.com/syohex/emacs-git-gutter
(use-package git-gutter
  :ensure t
  :pin melpa)

;; https://github.com/magit/magit
(use-package magit
  :ensure t
  :pin melpa)

;; https://github.com/Fanael/rainbow-delimiters
(use-package rainbow-delimiters
  :ensure t
  :pin melpa)

;; https://github.com/nonsequitur/smex
(use-package smex
  :ensure t
  :pin melpa)

;; https://github.com/bbatsov/solarized-emacs
(use-package solarized-theme
  :ensure t
  :pin melpa)

(when (memq window-system '(mac ns))
  (exec-path-from-shell-initialize))

;; Keep any customize declarations separately. 
(setq custom-file "~/.emacs.d/custom.el")
