           (setq avy-keys '(?a ?r ?s ?t ?d ?h ?n ?e ?i ?o))
           ;; setup C-' in isearch
           (avy-setup-default)))
+
+(defun clang-format-buffer-dwim ()
+  "Format buffer if sensible .clang-format found
+
+Searching for .clang-format in the project or in the current
+directory to account for adhoc examples not contained in a git
+repo."
+  (when (member major-mode '(c-mode c++-mode))
+    (let ((dir (locate-dominating-file "." ".clang-format")))
+      (when (and
+             dir
+             (or
+              (equal (expand-file-name (file-name-as-directory ".")) (expand-file-name dir))
+              (s-starts-with? (projectile-project-root) (expand-file-name dir))))
+        (clang-format-buffer)))))
+
+(use-package clang-format
+  :init (add-hook 'before-save-hook #'clang-format-buffer-dwim))
 
 (use-package company
   :init (global-company-mode))

;;
;; .dir-locals.el example
;; ((haskell-mode . ((dante-project-root . "/codemill/dudebout/repos/arc-systems/"))))

(use-package ediff
  :defer t


(use-package org-protocol)

(use-package org-pdftools)

(use-package pdf-tools)

