 ;;   (setq-local company-backends '(company-anaconda))
 ;;   (py-yapf-enable-on-save))
 
-(defun ar/python-mode-hook-function ()
-  "Called when entering `python-mode'."
-  (validate-setq python-indent-offset 2)
-  (validate-setq python-indent-guess-indent-offset nil)
-  (python-docstring-mode +1)
-  (py-yapf-enable-on-save))
-(add-hook 'python-mode-hook #'ar/python-mode-hook-function)
+(use-package python-docstring :ensure t
+  :hook (python-mode . python-docstring-mode))
+
+(use-package python
+  :init
+  (defun ar/python-mode-hook-function ()
+    "Called when entering `python-mode'."
+    (validate-setq python-indent-offset 2)
+    (validate-setq python-indent-guess-indent-offset nil))
+  :hook (python-mode . ar/python-mode-hook-function))
 
 (use-package objc-font-lock
   :ensure t

;; Formats python buffer with yapf
;; Install with: pip install git+https://github.com/google/yapf.git
(use-package py-yapf :ensure t
  :commands (py-yapf-enable-on-save)
  :config
  (validate-setq py-yapf-options '("--style={based_on_style: google, indent_width: 2}")))



;; Best way (so far) to search for files in repo.
(use-package helm-projectile :ensure t
  :bind ("C-x f" . helm-projectile))

(use-package ediff
  :init
  ;; ediff-revision cleanup.
  ;; From http://www.emacswiki.org/emacs/DavidBoon#toc8
  (defvar ar/ediff-bwin-config nil
    "Window configuration before ediff.")

  (defvar ar/ediff-bwin-reg ?b
    "Register to be set up to hold ar/ediff-bwin-config configuration.")

  (defun ar/ediff-bsh ()
    "Function to be called before any buffers or window setup for ediff."
    (remove-hook 'ediff-quit-hook #'ediff-cleanup-mess)
    (window-configuration-to-register ar/ediff-bwin-reg))

  (defun ar/ediff-aswh ()
    "Setup hook used to remove the `ediff-cleanup-mess' function.  It causes errors."
    (remove-hook 'ediff-quit-hook #'ediff-cleanup-mess))

  (defun ar/ediff-qh ()
    "Function to be called when ediff quits."
    (remove-hook 'ediff-quit-hook #'ediff-cleanup-mess)
    (ediff-cleanup-mess)
    (jump-to-register ar/ediff-bwin-reg))
  ;; Automatically highlight first change.
  :hook ((ediff-startup . ediff-next-difference)
         (ediff-before-setup . ar/ediff-bsh)
         (ediff-after-setup-windows . ar/ediff-aswh);
         (ediff-quit . ar/ediff-qh))
  :config
  (csetq ediff-window-setup-function #'ediff-setup-windows-plain)
  (csetq ediff-split-window-function #'split-window-horizontally)

  (use-package outline
    :after outline
    ;; Ensure ediff expands org files.
    :hook (ediff-prepare-buffer . outline-show-all))

  ;; Expand org files when ediffing.
  (add-hook 'ediff-prepare-buffer-hook
