 (defun ke/compile (argument &optional parallel-jobs silent alternative-compiler pre-make)
   "KE Compilation System, calls 'compile without cluttering the default values"
   (interactive "sTarget: ")
-  (ke/setup-path)
-  (let* ((full-path (ke/find-where-to-compile (if (eq major-mode 'dired-mode)
-                                                  (dired-current-directory)
-                                                (file-name-directory buffer-file-name))))
-         (compile-command (concat pre-make " make -C \""
-                                  full-path
-                                  "\" "
-                                  (when parallel-jobs (concat "-j" (number-to-string parallel-jobs)))
-                                  " "
-                                  (when silent "--silent")
-                                  " "
-                                  (when alternative-compiler (concat "CXX=\"" alternative-compiler "\""))
-                                  " "
-                                  argument)))
-    (call-interactively 'compile)
-    (ke/reset-path)))
+  (ke/with-compilation-path
+   (let* ((full-path (ke/find-where-to-compile (if (eq major-mode 'dired-mode)
+                                                   (dired-current-directory)
+                                                 (file-name-directory buffer-file-name))))
+          (compile-command (concat pre-make " make -C \""
+                                   full-path
+                                   "\" "
+                                   (when parallel-jobs (concat "-j" (number-to-string parallel-jobs)))
+                                   " "
+                                   (when silent "--silent")
+                                   " "
+                                   (when alternative-compiler (concat "CXX=\"" alternative-compiler "\""))
+                                   " "
+                                   argument)))
+     (call-interactively 'compile))))
+
 
 ;; Set the bear command
 (defun ke/generate-bear-command ()

  "Remove white spaces in beginning and ending of STRING.
White space here is any of: space, tab, emacs newline (line feed, ASCII 10)."
  (replace-regexp-in-string "\\`[ \t\n]*" "" (replace-regexp-in-string "[ \t\n]*\\'" "" string)))

(defun ke/reset-path ()
  "Reset the path to the original one"
  (when ke/original-path (setenv "PATH" ke/original-path)))

(defun ke/find-root-dir (path look-for-member &optional discarded)
  "Recursively finds for a directory in the given path"

  "Set this to the location of your Bear binary"
  :group 'my/dotemacs)

(defun ke/setup-path ()
  "Sets the KE's path"
  (setenv "PATH"
          (concat "/ke/local/toolchain3-x86_64-nptl/bin:"
                  "/ke/local/toolchain3-x86_64-nptl/tools/bin:"
