                                  " DerivePointerAlignment: false,"
                                  " Standard: Cpp11}"))
 
+(setq clang-format-executable
+      (if (executable-find "clang-format") "clang-format"
+        (if (executable-find "clang-format-3.8") "clang-format-3.8"
+          (if (executable-find "clang-format-3.7") "clang-format-3.7"
+            (if (executable-find "clang-format37") "clang-format37"
+              (if (executable-find "clang-format-3.6") "clang-format-3.6"
+                (if (executable-find "clang-format-3.5")
+                    (progn
+                      (setq clang-format-style (concat "{BasedOnStyle: Google,"
+                                                       " BreakBeforeBraces: Linux,"
+                                                       " BinPackParameters: true,"
+                                                       " BreakBeforeBinaryOperators: true,"
+                                                       " IndentWidth: 2,"
+                                                       " ColumnLimit: 90,"
+                                                       " AlwaysBreakBeforeMultilineStrings: false,"
+                                                       " SpacesBeforeTrailingComments: 4,"
+                                                       " AccessModifierOffset: -2,"
+                                                       " AllowShortFunctionsOnASingleLine: Inline,"
+                                                       " NamespaceIndentation: All,"
+                                                       " UseTab: Never,"
+                                                       " ConstructorInitializerIndentWidth: 2,"
+                                                       " ContinuationIndentWidth: 2,"
+                                                       " PointerAlignment: Left,"
+                                                       " DerivePointerAlignment: false,"
+                                                       " Standard: Cpp11}"))
+                      "clang-format-3.5"))))))))
+
 (with-eval-after-load 'company
   (diminish 'company-mode)
   (setq company-idle-delay nil)  ;; 0.1)


(defun my-c-mode-common-hook ()
  (setq-local fill-column 90)
  (setq rtags-autostart-diagnostics t
        ))  ;; rtags-show-containing-function t))

(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)


(set-face-attribute 'highlight-indentation-face     ;; elpy
                    nil
                    :background "gray90")
